/usr/share/calc/help/rcmul is in apcalc-common 2.12.4.4-2.
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 | NAME
rcmul - REDC multiplication
SYNOPSIS
rcmul(x, y, m)
TYPES
x integer
y integer
m odd positive integer
return integer v, 0 <= v < m.
DESCRIPTION
Let B be the base calc uses for representing integers internally
(B = 2^16 for 32-bit machines, 2^32 for 64-bit machines)
and N the number of words (base-B digits) in the representation
of m. Then rcmul(x,y,m) returns the value of B^-N * x * y % m,
where the inverse implicit in B^-N is modulo m
and the modulus operator % gives the least non-negative residue.
The normal use of rcmul() may be said to be that of multiplying modulo m
values encoded by rcin() and REDC functions, as in:
rcin(x * y, m) = rcmul(rcin(x,m), rcin(y,m), m),
or with only one factor encoded:
x * y % m = rcmul(rcin(x,m), y, m).
RUNTIME
If the value of m in rcmul(x,y,m) is being used for the first time
in a REDC function, the information required for the REDC
algorithms is calculated and stored for future use, possibly
replacing an already stored valued, in a table covering up to 5
(i.e. MAXREDC) values of m. The runtime required for this is about
two times that required for multiplying two N-word integers.
Two algorithms are available for evaluating rcmul(x,y,m), the one
which is usually faster for small N is used when N <
config("redc2"); the other is usually faster for larger N. If
config("redc2") is set at about 90 and x and y have both been
reduced modulo m, the runtime required for rcmul(x,y,m) is at most
about f times the runtime required for an N-word by N-word
multiplication, where f increases from about 1.3 for N = 1 to near
3 for N > 90. More runtime may be required if x and y have to be
reduced modulo m.
EXAMPLE
Using a 64-bit machine with B = 2^32:
; print rcin(4 * 5, 9), rcmul(rcin(4,9), rcin(5,9), 9), rcout(8, 9);
8 8 2
LIMITS
none
LINK LIBRARY
void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res)
SEE ALSO
rcin, rcout, rcsq, rcpow
## 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: rcmul,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/rcmul,v $
##
## Under source code control: 1996/02/25 02:22:21
## File existed as early as: 1996
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|