man(1) Manual page archive

     MP(3X)                                                     MP(3X)

          itom, madd, msub, mmul, mdiv, msqrt, mgcd, mget, mput, mmov,
          mcmp, mexp, mpow - multiple precision integer arithmetic

          #include <mp.h>

          mint *itom(n)
          int n;

          madd(a, b, c)
          msub(a, b, c)
          mmul(a, b, c)
          mgcd(a, b, c)
          mdiv(a, b, q, r)
          msqrt(a, b, r)
          mexp(a, b, c)
          mpow(a, b, m, c)
          mmov(a, b)
          mcmp(a, b)
          mint *a, *b, *c, *m, *q, *r;

          sdiv(a, n, q, r)
          mint *a, *q;
          int n;
          short *r;

          These routines perform arithmetic on arbitrary-length inte-
          gers of defined type mint. The functions are obtained with
          ld(1) option -lmp.

          Pointers to mint must be initialized using the function
          itom, which sets the initial value to n. Thereafter space is
          managed automatically by the routines.

          Madd, msub, mmul, and mgcd assign to their third arguments
          the sum, difference, product, and greatest common divisor,
          respectively, of their first two arguments.

          Mdiv assigns the quotient and remainder, respectively, to
          its third and fourth arguments.  Sdiv is like mdiv except
          that the divisor is an ordinary integer.

          Msqrt assigns to its second and third arguments the square
          root and remainder, repsectively, of its first argument.

          Mexp calculates a raised to the power b; mpow calculates

     MP(3X)                                                     MP(3X)

          this reduced modulo m.

          Mmov assigns the value of its first argument to its second

          Mcmp returns a negative, zero, or positive integer if the
          value of its first argument is less than, equal to, or
          greater than, respectively, the value of its second argu-

          Mget and mput do decimal conversion from `stdin' and to
          `stdout', respectively, of stdio(3).

          Illegal operations and running out of memory produce mes-
          sages and core images.