BSD 4_3_Reno development
[unix-history] / usr / share / man / cat3 / mp.0
MP(3X) 1986 MP(3X)
N\bNA\bAM\bME\bE
madd, msub, mult, mdiv, pow, gcd, invert, rpow, msqrt, mcmp,
move, min, omin, fmin, m_in, mout, omout, fmout, m_out,
sdiv, itom - multiple precision integer arithmetic
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<m\bmp\bp.\b.h\bh>\b>
#\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bst\btd\bdi\bio\bo.\b.h\bh>\b>
t\bty\byp\bpe\bed\bde\bef\bf s\bst\btr\bru\buc\bct\bt m\bmi\bin\bnt\bt {\b{ i\bin\bnt\bt l\ble\ben\bn;\b; s\bsh\bho\bor\brt\bt *\b*v\bva\bal\bl;\b; }\b} M\bMI\bIN\bNT\bT;\b;
m\bma\bad\bdd\bd(\b(a\ba,\b, b\bb,\b, c\bc)\b)
m\bms\bsu\bub\bb(\b(a\ba,\b, b\bb,\b, c\bc)\b)
m\bmu\bul\blt\bt(\b(a\ba,\b, b\bb,\b, c\bc)\b)
m\bmd\bdi\biv\bv(\b(a\ba,\b, b\bb,\b, q\bq,\b, r\br)\b)
p\bpo\bow\bw(\b(a\ba,\b, b\bb,\b, m\bm,\b, c\bc)\b)
g\bgc\bcd\bd(\b(a\ba,\b, b\bb,\b, c\bc)\b)
i\bin\bnv\bve\ber\brt\bt(\b(a\ba,\b, b\bb,\b, c\bc)\b)
r\brp\bpo\bow\bw(\b(a\ba,\b, n\bn,\b, c\bc)\b)
m\bms\bsq\bqr\brt\bt(\b(a\ba,\b, b\bb,\b, r\br)\b)
m\bmc\bcm\bmp\bp(\b(a\ba,\b, b\bb)\b)
m\bmo\bov\bve\be(\b(a\ba,\b, b\bb)\b)
m\bmi\bin\bn(\b(a\ba)\b)
o\bom\bmi\bin\bn(\b(a\ba)\b)
f\bfm\bmi\bin\bn(\b(a\ba,\b, f\bf)\b)
m\bm_\b_i\bin\bn(\b(a\ba,\b, n\bn,\b, f\bf)\b)
m\bmo\bou\but\bt(\b(a\ba)\b)
o\bom\bmo\bou\but\bt(\b(a\ba)\b)
f\bfm\bmo\bou\but\bt(\b(a\ba,\b, f\bf)\b)
m\bm_\b_o\bou\but\bt(\b(a\ba,\b, n\bn,\b, f\bf)\b)
M\bMI\bIN\bNT\bT *\b*a\ba,\b, *\b*b\bb,\b, *\b*c\bc,\b, *\b*m\bm,\b, *\b*q\bq,\b, *\b*r\br;\b;
F\bFI\bIL\bLE\bE *\b*f\bf;\b;
i\bin\bnt\bt n\bn;\b;
s\bsd\bdi\biv\bv(\b(a\ba,\b, n\bn,\b, q\bq,\b, r\br)\b)
M\bMI\bIN\bNT\bT *\b*a\ba,\b, *\b*q\bq;\b;
s\bsh\bho\bor\brt\bt n\bn;\b;
s\bsh\bho\bor\brt\bt *\b*r\br;\b;
M\bMI\bIN\bNT\bT *\b*i\bit\bto\bom\bm(\b(n\bn)\b)
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
These routines perform arithmetic on integers of arbitrary
length. The integers are stored using the defined type
_\bM_\bI_\bN_\bT. Pointers to a _\bM_\bI_\bN_\bT can be initialized using the func-
tion _\bi_\bt_\bo_\bm which sets the initial value to _\bn. After that,
space is managed automatically by the routines.
_\bm_\ba_\bd_\bd, _\bm_\bs_\bu_\bb and _\bm_\bu_\bl_\bt assign to _\bc the sum, difference and pro-
duct, respectively, of _\ba and _\bb. _\bm_\bd_\bi_\bv assigns to _\bq and _\br the
quotient and remainder obtained from dividing _\ba by _\bb. _\bs_\bd_\bi_\bv
is like _\bm_\bd_\bi_\bv except that the divisor is a short integer _\bn
Printed 7/27/90 June 1
MP(3X) 1986 MP(3X)
and the remainder is placed in a short whose address is
given as _\br. _\bm_\bs_\bq_\br_\bt produces the integer square root of _\ba in
_\bb and places the remainder in _\br. _\br_\bp_\bo_\bw calculates in _\bc the
value of _\ba raised to the (``regular'' integral) power _\bn,
while _\bp_\bo_\bw calculates this with a full multiple precision
exponent _\bb and the result is reduced modulo _\bm. _\bg_\bc_\bd returns
the greatest common denominator of _\ba and _\bb in _\bc, and _\bi_\bn_\bv_\be_\br_\bt
computes _\bc such that _\ba*_\bc mod _\bb = 1, for _\ba and _\bb relatively
prime. _\bm_\bc_\bm_\bp returns a negative, zero or positive integer
value when _\ba is less than, equal to or greater than _\bb,
respectively. _\bm_\bo_\bv_\be copies _\ba to _\bb. _\bm_\bi_\bn and _\bm_\bo_\bu_\bt do decimal
input and output while _\bo_\bm_\bi_\bn and _\bo_\bm_\bo_\bu_\bt do octal input and
output. More generally, _\bf_\bm_\bi_\bn and _\bf_\bm_\bo_\bu_\bt do decimal input and
output using file _\bf, and _\bm__\bi_\bn and _\bm__\bo_\bu_\bt do I/O with arbi-
trary radix _\bn. On input, records should have the form of
strings of digits terminated by a newline; output records
have a similar form.
Programs which use the multiple-precision arithmetic library
must be loaded using the loader flag -_\bl_\bm_\bp.
F\bFI\bIL\bLE\bES\bS
/usr/include/mp.h include file
/usr/lib/libmp.a object code library
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
dc(1), bc(1)
D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
Illegal operations and running out of memory produce mes-
sages and core images.
B\bBU\bUG\bGS\bS
Bases for input and output should be <= 10.
_\bd_\bc(1) and _\bb_\bc(1) don't use this library.
The input and output routines are a crock.
_\bp_\bo_\bw is also the name of a standard math library routine.
Printed 7/27/90 June 2