mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
69 lines
2.1 KiB
Plaintext
69 lines
2.1 KiB
Plaintext
NAME
|
|
quomod - assign quotient and remainder to two variables
|
|
|
|
SYNOPSIS
|
|
quomod(x, y, q, r)
|
|
|
|
TYPES
|
|
x real
|
|
y real
|
|
q any
|
|
r any
|
|
|
|
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.
|
|
|
|
XXX - need to document relationship with "quomod" config value
|
|
|
|
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
|
|
|
|
XXX - need examples of how the "quomod" config file changes results
|
|
|
|
LIMITS
|
|
y > 0
|
|
|
|
LINK LIBRARY
|
|
BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod)
|
|
|
|
SEE ALSO
|
|
//, %
|
|
|
|
## Copyright (C) 1999 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.1 $
|
|
## @(#) $Id: quomod,v 29.1 1999/12/14 09:16:03 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://reality.sgi.com/chongo/
|
|
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|