Description

These functions perform arithmetic on integers of arbitrary length. The integers are
stored using the defined type MINT. Pointers to a MINT should be
initialized using the function mp_itom(n), which sets the initial value to n.
Alternatively, mp_xtom(a) may be used to initialize a MINT from a string
of hexadecimal digits. mp_mfree(a) may be used to release the storage allocated
by the mp_itom(a) and mp_xtom(a) routines.

The mp_madd(a,b,c), mp_msub(a,b,c) and mp_mult(a,b,c) functions assign to their third arguments the
sum, difference, and product, respectively, of their first two arguments. The
mp_mdiv(a,b,q,r) function assigns the quotient and remainder, respectively, to its third and fourth
arguments. The mp_sdiv(a,n,q,r) function is similar to mp_mdiv(a,b,q,r) except that the
divisor is an ordinary integer. The mp_msqrt(a,b,r) function produces the square root
and remainder of its first argument. The mp_mcmp(a,b) function compares the
values of its arguments and returns 0 if the two values
are equal, a value greater than 0 if the first argument is
greater than the second, and a value less than 0 if
the second argument is greater than the first. The mp_rpow(a,n,b) function
raises a to the nth power and assigns this value to b.
The mp_pow(a,b ,c,d) function raises a to the bth power, reduces the result
moduloc and assigns this value to d. The mp_min(a) and
mp_mout(a) functions perform decimal input and output. The mp_gcd(a,b,c) function finds the
greatest common divisor of the first two arguments, returning it in the
third argument. The mp_mtox( a) function provides the inverse of mp_xtom(a). To release
the storage allocated by mp_mtox(a) use free() (see malloc(3C)).

Attributes

See Also

Diagnostics

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

Warnings

The function pow() exists in both libmp and libm with widely differing
semantics. This is the reason libmp.so.2 exists. libmp.so.1 exists solely for reasons
of backward compatibility, and should not be used otherwise. Use the mp_*( )
functions instead. See libmp(3LIB).