Research V7 development
[unix-history] / usr / man / man3 / mp.3x
CommitLineData
7c5a8800
PW
1.TH MP 3X
2.SH NAME
3itom, madd, msub, mult, mdiv, min, mout,
4pow, gcd, rpow \- multiple precision integer arithmetic
5.SH SYNOPSIS
6.nf
7.B "typedef struct { int len; short *val; } mint;"
8.PP
9.PP
10.B madd(a, b, c)
11.B msub(a, b, c)
12.B mult(a, b, c)
13.B mdiv(a, b, q, r)
14.B min(a)
15.B mout(a)
16.B pow(a, b, m, c)
17.B gcd(a, b, c)
18.B rpow(a, b, c)
19.B msqrt(a, b, r)
20.B mint *a, *b, *c, *m, "*q, *r;"
21.PP
22.B
23.B sdiv(a, n, q, r)
24.B mint *a, *q;
25.B short *r;
26.PP
27.B mint *itom(n)
28.SH DESCRIPTION
29These routines perform arithmetic on integers of
30arbitrary length.
31The integers are stored using the defined type
32.I mint.
33Pointers to
34a
35.I mint
36should be initialized using the function
37.IR itom ,
38which sets the initial value to
39.IR n .
40After that space is managed automatically by the routines.
41.PP
42.IR madd , " msub" , " mult" ,
43assign to their third arguments the sum, difference, and
44product, respectively, of their first two arguments.
45.I mdiv
46assigns the quotient and remainder, respectively,
47to its third and fourth arguments.
48.I sdiv
49is like
50.I mdiv
51except that the divisor is an ordinary integer.
52.I msqrt
53produces the square root and remainder of its first argument.
54.I rpow
55calculates
56.I a
57raised to the power
58.IR b ,
59while
60.I pow
61calculates this reduced modulo
62.IR m .
63.IR min " and" mout
64do decimal input and output.
65.PP
66The functions are obtained with the
67loader option
68.IR -lmp .
69.SH DIAGNOSTICS
70Illegal operations and running out of memory
71produce messages and core images.