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

## NAME

```6`       itom, madd, msub, mult, mdiv, min, mout, pow, gcd, rpow - multiple pre‐`
7`       cision integer arithmetic`
8
```

## SYNOPSIS

```10`       typedef struct { int len; short *val; } mint;`
11
12`       madd(a, b, c)`
13`       msub(a, b, c)`
14`       mult(a, b, c)`
15`       mdiv(a, b, q, r)`
16`       min(a)`
17`       mout(a)`
18`       pow(a, b, m, c)`
19`       gcd(a, b, c)`
20`       rpow(a, b, c)`
21`       msqrt(a, b, r)`
22`       mint *a, *b, *c, *m, *q, *r;`
23
24`       sdiv(a, n, q, r)`
25`       mint *a, *q;`
26`       short *r;`
27
28`       mint *itom(n)`
29
```

## DESCRIPTION

```31`       These routines perform arithmetic on integers of arbitrary length.  The`
32`       integers  are  stored  using the defined type mint.  Pointers to a mint`
33`       should be initialized using the function itom, which sets  the  initial`
34`       value to n.  After that space is managed automatically by the routines.`
35
36`       madd,  msub, mult, assign to their third arguments the sum, difference,`
37`       and product, respectively, of their first two arguments.  mdiv  assigns`
38`       the quotient and remainder, respectively, to its third and fourth argu‐`
39`       ments.  sdiv is like mdiv except that the divisor is an ordinary  inte‐`
40`       ger.   msqrt  produces the square root and remainder of its first argu‐`
41`       ment.  rpow calculates a raised to the power b,  while  pow  calculates`
42`       this reduced modulo m.  min andmout do decimal input and output.`
43
44`       The functions are obtained with the loader option -lmp.`
45
```

## DIAGNOSTICS

```47`       Illegal  operations and running out of memory produce messages and core`
48`       images.`
49
50
51
52`                                                                        MP(3X)`
```