4.4BSD/usr/share/man/cat3/mp.0
MP(3) BSD Programmer's Manual MP(3)
NNAAMMEE
ffmmiinn, ffmmoouutt, ggccdd, iinnvveerrtt, iittoomm mm__iinn, mm__oouutt, mmaadddd, mmccmmpp,, mmddiivv, mmiinn, mmoouutt,
mmoovvee, mmssqqrrtt, mmssuubb, mmuulltt, oommiinn, oommoouutt, ppooww, rrppooww, ssddiivv, - multiple preci-
sion integer arithmetic
SSYYNNOOPPSSIISS
##iinncclluuddee <<mmpp..hh>>
##iinncclluuddee <<ssttddiioo..hh>>
ttyyppeeddeeff ssttrruucctt mmiinntt {{ iinntt lleenn;; sshhoorrtt **vvaall;; }} MMIINNTT;;
mmaadddd(_M_I_N_T _*_a, _M_I_N_T _*_b, _M_I_N_T _*_c);
mmssuubb(_M_I_N_T _*_a, _M_I_N_T _*_b, _M_I_N_T _*_c);
mmuulltt(_M_I_N_T _*_a, _M_I_N_T _*_b, _M_I_N_T _*_c);
mmddiivv(_M_I_N_T _*_a, _M_I_N_T _*_b, _M_I_N_T _*_q, _s_h_o_r_t _r);
ppooww(_M_I_N_T _*_a, _M_I_N_T _*_b, _m, _M_I_N_T _*_c);
ggccdd(_M_I_N_T _*_a, _M_I_N_T _*_b, _M_I_N_T _*_c);
iinnvveerrtt(_M_I_N_T _*_a, _M_I_N_T _*_b, _M_I_N_T _*_c);
rrppooww(_M_I_N_T _*_a, _s_h_o_r_t _n, _M_I_N_T _*_c);
mmssqqrrtt(_M_I_N_T _*_a, _M_I_N_T _*_b, _s_h_o_r_t _r);
mmccmmpp(_M_I_N_T _*_a, _M_I_N_T _*_b);
mmoovvee(_M_I_N_T _*_a, _M_I_N_T _*_b);
mmiinn(_M_I_N_T _*_a);
oommiinn(_M_I_N_T _*_a);
ffmmiinn(_M_I_N_T _*_a, _F_I_L_E _*_f);
mm__iinn(_M_I_N_T _*_a, _i_n_t _n, _F_I_L_E _*_f);
mmoouutt(_M_I_N_T _*_a);
oommoouutt(_M_I_N_T _*_a);
ffmmoouutt(_M_I_N_T _*_a, _F_I_L_E _*_f);
mm__oouutt(_M_I_N_T _*_a, _i_n_t _n, _F_I_L_E _*_f);
ssddiivv(_M_I_N_T _*_a, _s_h_o_r_t _n, _M_I_N_T _*_q, _s_h_o_r_t _r);
iittoomm(_s_h_o_r_t _n);
DDEESSCCRRIIPPTTIIOONN
TThhee iinntteerrffaaccee ffoorr tthhiiss lliibbrraarryy iiss eexxppeecctteedd ttoo cchhaannggee..
These functions operate on integers of variable length. The function
iittoomm() allocates space for an integer of length _n which may be accessed
via the returned _M_I_N_T pointer. The underlying storage scheme is trans-
parent to the user.
ffmmiinn()
ffmmoouutt() Convert decimal input and output using file _f.
ggccdd() Finds the greatest common denominator of _a and _b, storing the
result in _c.
iinnvveerrtt()
Computes _c such that _a* _c mod _b = 1, for _a and _b relatively
prime.
mm__iinn()
mm__oouutt() I/O with arbitrary radix _n.
mmaadddd() The sum of _a and _b is stored in _c.
mmccmmpp() Returns a negative, zero or positive integer value when _a is
less than, equal to or greater than _b, respectively.
mmoovvee() Copies _a to _b.
mmiinn()
mmoouutt() Convert decimal input and output.
mmddiivv() Divides _a by _b and stores the quotient in _q and the remainder in
_r.
mmssqqrrtt() Calculates the integer square root of _a in _b and places the re-
mainder in _r.
mmssuubb() The difference of _a and _b is stored in _c.
mmuulltt() The product of _a and _b is stored in _c.
oommiinn()
oommoouutt() Convert octal input and output.
ppooww() Calculates the value of _a raised to the full multiple precision
exponent _b, the result is reduced modulo _m and stored in _c.
rrppooww() Calculates the value of _a raised to the (``regular'' integral)
power _n and stores the result in _c.
ssddiivv() (Short divisor.) Divides _a by the short integer _b and stores
the quotient in _q and the remainder in short integer _r. On in-
put, records should have the form of strings of digits terminat-
ed by a newline; output records have a similar form.
FFIILLEESS
/usr/lib/libmp.a object code library
/usr/include/mp.h include file
SSEEEE AALLSSOO
dc(1), bc(1)
HHIISSTTOORRYY
A ggccdd(), iittoomm(), mmaadddd(), mmddiivv(), mmiinn(), mmoouutt(), mmssqqrrtt(), mmssuubb(), mmuulltt(),
ppooww(), rrppooww(), and ssddiivv() function appeared in Version 7 AT&T UNIX.
BBUUGGSS
Bases for input and output should be <= 10.
The interpreters dc(1) and bc(1) don't use this library.
The input and output routines are a crock.
The function name ppooww() is also the name of a standard math library rou-
tine.
4.3 Berkeley Distribution June 4, 1993 2