/usr/share/calc/help/quo is in apcalc-common 2.12.4.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | NAME
quo - compute integer quotient of a value by a real number
SYNOPSIS
quo(x, y, rnd) or x // y
TYPES
If x is a matrix or list, the returned value is a matrix or list v of
the same structure for which each element v[[i]] = quo(x[[i]], y, rnd).
If x is an xx-object or x is not an object and y is an xx-object,
this function calls the user-defined function xx_quo(x, y, rnd);
the types of arguments and returned value are as required by the
definition of xx_quo().
If neither x nor y is an object, and x is not a matrix or list:
x number (real or complex)
y real
rnd integer, defaults to config("quo")
return number
DESCRIPTION
If x is real or complex and y is zero, quo(x, y, rnd) returns zero.
If x is complex, quo(x, y, rnd) returns
quo(re(x), y, rnd) + quo(im(x), y, rnd) * 1i.
In the following it is assumed that x is real and y is nonzero.
If x/y is an integer quo(x, y, rnd) returns x/y.
If x is real, y nonzero and x/y is not an integer, x // y returns
one of the two integers v for which abs(x/y - v) < 1. Which
integer is returned is controlled by rnd as follows:
rnd sign of x/y - v Description of rounding
0 + down, towards minus infinity
1 - up, towards infinity
2 sgn(x/y) towards zero
3 -sgn(x/y) from zero
4 sgn(y)
5 -sgn(y)
6 sgn(x)
7 -sgn(x)
8 to nearest even integer
9 to nearest odd integer
10 even if x/y > 0, otherwise odd
11 odd if x/y > 0, otherwise even
12 even if y > 0, otherwise odd
13 odd if y > 0, otherwise even
14 even if x > 0, otherwise odd
15 odd if x > 0, otherwise even
16-31 to nearest integer when this
is uniquely determined;
otherwise, when x/y is a
half-integer, as if
rnd replaced by rnd & 15
NOTE: Blank entries in the table above indicate that the
description would be complicated and probably not of
much interest.
The C language method of modulus and integer division is:
config("quomod", 2)
config("quo", 2)
config("mod", 2)
EXAMPLE
print quo(11,5,0), quo(11,5,1), quo(-11,5,2), quo(-11,-5,3)
2 3 -2 3
print quo(12.5,5,16), quo(12.5,5,17), quo(12.5,5,24), quo(-7.5,-5,24)
2 3 2 2
LIMITS
none
LINK LIBRARY
void quovalue(VALUE *x, VALUE *y, VALUE *rnd, VALUE *result)
NUMBER *qquo(NUMBER *x, NUMBER *y, long rnd)
SEE ALSO
mod, quomod, //, %
## 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.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: quo,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/quo,v $
##
## Under source code control: 1995/09/18 04:01:44
## 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/
|