1MP(3X)                                                                  MP(3X)
2
3
4

NAME

6       madd, msub, mult, mdiv, pow, gcd, invert, rpow, msqrt, mcmp, move, min,
7       omin, fmin, m_in, mout, omout, fmout, m_out, sdiv, itom - multiple pre‐
8       cision integer arithmetic
9

SYNOPSIS

11       #include <mp.h>
12       #include <stdio.h>
13
14       typedef struct mint { int len; short *val; } MINT;
15
16       madd(a, b, c)
17       msub(a, b, c)
18       mult(a, b, c)
19       mdiv(a, b, q, r)
20       pow(a, b, m, c)
21       gcd(a, b, c)
22       invert(a, b, c)
23       rpow(a, n, c)
24       msqrt(a, b, r)
25       mcmp(a, b)
26       move(a, b)
27       min(a)
28       omin(a)
29       fmin(a, f)
30       m_in(a, n, f)
31       mout(a)
32       omout(a)
33       fmout(a, f)
34       m_out(a, n, f)
35       MINT *a, *b, *c, *m, *q, *r;
36       FILE *f;
37       int n;
38
39       sdiv(a, n, q, r)
40       MINT *a, *q;
41       short n;
42       short *r;
43
44       MINT *itom(n)
45

DESCRIPTION

47       These routines perform arithmetic on integers of arbitrary length.  The
48       integers are stored using the defined type MINT.  Pointers  to  a  MINT
49       can be initialized using the function itom which sets the initial value
50       to n.  After that, space is managed automatically by the routines.
51
52       madd, msub and mult assign  to  c  the  sum,  difference  and  product,
53       respectively,  of  a  and  b.  mdiv assigns to q and r the quotient and
54       remainder obtained from dividing a by b.  sdiv is like mdiv except that
55       the divisor is a short integer n and the remainder is placed in a short
56       whose address is given as r.  msqrt produces the integer square root of
57       a  in  b and places the remainder in r.  rpow calculates in c the value
58       of a raised to the (``regular'' integral) power n, while pow calculates
59       this  with  a  full  multiple  precision  exponent  b and the result is
60       reduced modulo m.  gcd returns the greatest common denominator of a and
61       b in c, and invert computes c such that a*c mod b = 1, for a and b rel‐
62       atively prime.  mcmp returns a negative, zero or positive integer value
63       when  a  is  less than, equal to or greater than b, respectively.  move
64       copies a to b.  min and mout do decimal input and output while omin and
65       omout  do  octal  input  and output.  More generally, fmin and fmout do
66       decimal input and output using file f, and m_in and m_out do  I/O  with
67       arbitrary  radix  n.  On input, records should have the form of strings
68       of digits terminated by a newline; output records have a similar form.
69
70       Programs which use the multiple-precision arithmetic  library  must  be
71       loaded using the loader flag -lmp.
72

FILES

74       /usr/include/mp.h   include file
75       /usr/lib/libmp.a    object code library
76

SEE ALSO

78       dc(1), bc(1)
79

DIAGNOSTICS

81       Illegal  operations and running out of memory produce messages and core
82       images.
83

BUGS

85       Bases for input and output should be <= 10.
86
87       dc(1) and bc(1) don't use this library.
88
89       The input and output routines are a crock.
90
91       pow is also the name of a standard math library routine.
92
93
94
954.3 Berkeley Distribution        June 4, 1986                           MP(3X)
Impressum