NAME
    quomod - assign quotient and remainder to two variables

SYNOPSIS
    quomod(x, y, q, r [, rnd])

TYPES
    x		real
    y		real
    q		any
    r		any
    rnd		integer, defaults to config("quomod")

    return	real

DESCRIPTION
    Returns 0 or 1 according as x is or is not a multiple of y.
    Let	 x = q * y + r	where q is an integer and 0 <= r < y
    This function assigns the values q and r to the variables
    Q and R.  If x >= 0, the results for Q and R are the same as
    those given by Q = x // y, R = x % y.

    The argument rnd (if passed or config value config("quomod") if the
    rnd argument is not passed) impacts the rounding mode for producing
    the quotient and modulus.  See "help quo" details of how the quotient
    is impacted by rounding modes.  See "help mod" for details of how
    the modulus is impacted by rounding modes.  The only difference on
    those descriptions is that quomod() is controlled by a single config
    value config("quomod") instead of config("quo") and config("mod").

	XXX - replace the above paragraph and directly describe how rnd
	      and config("quomod") impact quomod.

    The C language method of modulus and integer division is:

	    config("quomod", 2)
	    config("quo", 2)
	    config("mod", 2)

EXAMPLE
    ; global u, v;
    ; global mat M[2];
    ; print quomod(13,5,u,v), u, v, quomod(15.6,5.2,M[0],M[1]), M[0], M[1];
    1 2 3 0 3 0

    ; A = assoc();
    ; print quomod(13, 5, A[1], A[2]), A[1], A[2]
    ; 1 2 3

    ; print quomod(10, -3, u, v), u, v;
    1 -4 -2
    ; print quomod(10, -3, u, v, 0), u, v;
    1 -4 -2
    ; print quomod(10, -3, u, v, 1), u, v;
    1 -3 1
    ; print quomod(10, -3, u, v, 2), u, v;
    1 -3 1
    ; print quomod(-10, -3, u, v, 2), u, v;
    1 3 -1

LIMITS
    y > 0

LINK LIBRARY
    BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod)

SEE ALSO
    //,	 %

## Copyright (C) 1999-2006  Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL.  You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
##
## @(#) $Revision: 29.5 $
## @(#) $Id: quomod,v 29.5 2006/06/25 20:33:26 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/quomod,v $
##
## Under source code control:	1995/05/07 03:17:03
## File existed as early as:	1995
##
## chongo <was here> /\oo/\	http://www.isthe.com/chongo/
## Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/
