MP(3X) 1986 MP(3X) NNAAMMEE 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 SSYYNNOOPPSSIISS ##iinncclluuddee <<mmpp..hh>> ##iinncclluuddee <<ssttddiioo..hh>> ttyyppeeddeeff ssttrruucctt mmiinntt {{ iinntt lleenn;; sshhoorrtt **vvaall;; }} MMIINNTT;; mmaadddd((aa,, bb,, cc)) mmssuubb((aa,, bb,, cc)) mmuulltt((aa,, bb,, cc)) mmddiivv((aa,, bb,, qq,, rr)) ppooww((aa,, bb,, mm,, cc)) ggccdd((aa,, bb,, cc)) iinnvveerrtt((aa,, bb,, cc)) rrppooww((aa,, nn,, cc)) mmssqqrrtt((aa,, bb,, rr)) mmccmmpp((aa,, bb)) mmoovvee((aa,, bb)) mmiinn((aa)) oommiinn((aa)) ffmmiinn((aa,, ff)) mm__iinn((aa,, nn,, ff)) mmoouutt((aa)) oommoouutt((aa)) ffmmoouutt((aa,, ff)) mm__oouutt((aa,, nn,, ff)) MMIINNTT **aa,, **bb,, **cc,, **mm,, **qq,, **rr;; FFIILLEE **ff;; iinntt nn;; ssddiivv((aa,, nn,, qq,, rr)) MMIINNTT **aa,, **qq;; sshhoorrtt nn;; sshhoorrtt **rr;; MMIINNTT **iittoomm((nn)) DDEESSCCRRIIPPTTIIOONN These routines perform arithmetic on integers of arbitrary length. The integers are stored using the defined type _M_I_N_T. Pointers to a _M_I_N_T can be initialized using the func- tion _i_t_o_m which sets the initial value to _n. After that, space is managed automatically by the routines. _m_a_d_d, _m_s_u_b and _m_u_l_t assign to _c the sum, difference and pro- duct, respectively, of _a and _b. _m_d_i_v assigns to _q and _r the quotient and remainder obtained from dividing _a by _b. _s_d_i_v is like _m_d_i_v except that the divisor is a short integer _n Printed 7/27/90 June 1 MP(3X) 1986 MP(3X) and the remainder is placed in a short whose address is given as _r. _m_s_q_r_t produces the integer square root of _a in _b and places the remainder in _r. _r_p_o_w calculates in _c the value of _a raised to the (``regular'' integral) power _n, while _p_o_w calculates this with a full multiple precision exponent _b and the result is reduced modulo _m. _g_c_d returns the greatest common denominator of _a and _b in _c, and _i_n_v_e_r_t computes _c such that _a*_c mod _b = 1, for _a and _b relatively prime. _m_c_m_p returns a negative, zero or positive integer value when _a is less than, equal to or greater than _b, respectively. _m_o_v_e copies _a to _b. _m_i_n and _m_o_u_t do decimal input and output while _o_m_i_n and _o_m_o_u_t do octal input and output. More generally, _f_m_i_n and _f_m_o_u_t do decimal input and output using file _f, and _m__i_n and _m__o_u_t do I/O with arbi- trary radix _n. 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 -_l_m_p. FFIILLEESS /usr/include/mp.h include file /usr/lib/libmp.a object code library SSEEEE AALLSSOO dc(1), bc(1) DDIIAAGGNNOOSSTTIICCSS Illegal operations and running out of memory produce mes- sages and core images. BBUUGGSS Bases for input and output should be <= 10. _d_c(1) and _b_c(1) don't use this library. The input and output routines are a crock. _p_o_w is also the name of a standard math library routine. Printed 7/27/90 June 2