MP(3X) UNIX Programmer's Manual MP(3X) NAME itom, mcmp, m_in, m_out, madd, msub, mult, mdiv, min, mout, pow, gcd, rpow - multiple precision integer arithmetic SYNOPSIS #include typedef struct mint { int len; short *val; } MINT; madd(a, b, c) msub(a, b, c) mult(a, b, c) mdiv(a, b, q, r) min(a) mout(a) pow(a, b, m, c) gcd(a, b, c) rpow(a, n, c) msqrt(a, b, r) mcmp(a,b) MINT *a, *b, *c, *m, *q, *r; int n; sdiv(a, n, q, r) MINT *a, *q; short *r; MINT *itom(n) cc ... -lmp DESCRIPTION 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, _m_u_l_t, assign to their third arguments the sum, difference, and product, respectively, of their first two arguments. _m_d_i_v assigns the quotient and remainder, respec- tively, to its third and fourth arguments. _s_d_i_v is like _m_d_i_v except that the divisor is an ordinary integer. _m_s_q_r_t produces the square root and remainder of its first argu- ment. _r_p_o_w calculates _a raised to the (``regular'' integral) power _n, while _p_o_w calculates this (for *_n a _M_I_N_T) reduced modulo _m. _m_i_n and _m_o_u_t do decimal input and output. More generally, _f_m_i_n and _f_m_o_u_t do decimal input and output from file _f, and _m__i_n and _m__o_u_t do I/O base _n. The functions are obtained with the loader option -_l_m_p. Printed 7/31/83 1 MP(3X) UNIX Programmer's Manual MP(3X) FILES /usr/include/mp.h include file /usr/lib/libmp.a object code library SEE ALSO ape(3X) DIAGNOSTICS Illegal operations and running out of memory produce mes- sages and core images. BUGS Bases for input and output should be <= 10. The _m_p package has some bugs--users are advised to use _a_p_e instead. Printed 7/31/83 2