Multiple Precision Library Functions mp(3MP)
NAME
mp, mpmadd, mpmsub, mpmult, mpmdiv, mpmcmp, mpmin,
mpmout, mppow, mpgcd, mprpow, mpmsqrt, mpsdiv,
mpitom, mpxtom, mpmtox, mpmfree - multiple precision
integer arithmetic
SYNOPSIS
cc [ flag... ] file... -lmp [ library... ]
#include
void mpmadd(MINT *a, MINT *b, MINT *c);
void mpmsub(MINT *a, MINT *b, MINT *c);
void mpmult(MINT *a, MINT *b, MINT *c);
void mpmdiv(MINT *a, MINT *b, MINT *q, MINT *r);
int mpmcmp(MINT *a, MINT *b);
int mpmin(MINT *a);
void mpmout(MINT *a);
void mppow(MINT *a, MINT *b, MINT *c, MINT *d);
void mpgcd(MINT *a, MINT *b, MINT *c);
void mprpow(MINT *a, short n, MINT *b);
int mpmsqrt(MINT *a, MINT *b, MINT *r);
void mpsdiv(MINT *a, short n, MINT *q, short *r);
MINT * mpitom(short n);
MINT * mpxtom(char *a);
SunOS 5.11 Last change: 14 Nov 2002 1
Multiple Precision Library Functions mp(3MP)
char * mpmtox(MINT *a);
void mpmfree(MINT *a);
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
mpitom(n), which sets the initial value to n. Alterna-
tively, mpxtom(a) may be used to initialize a MINT from a
string of hexadecimal digits. mpmfree(a) may be used to
release the storage allocated by the mpitom(a) and
mpxtom(a) routines.
The mpmadd(a,b,c), mpmsub(a,b,c) and mpmult(a,b,c) func-
tions assign to their third arguments the sum, difference,
and product, respectively, of their first two arguments.
The mpmdiv(a,b,q,r) function assigns the quotient and
remainder, respectively, to its third and fourth arguments.
The mpsdiv(a,n,q,r) function is similar to mpmdiv(a,b,q,r)
except that the divisor is an ordinary integer. The
mpmsqrt(a,b,r) function produces the square root and
remainder of its first argument. The mpmcmp(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
mprpow(a,n,b) function raises a to the nth power and
assigns this value to b. The mppow(a,b ,c,d) function
raises a to the bth power, reduces the result modulo c and
assigns this value to d. The mpmin(a) and mpmout(a) func-
tions perform decimal input and output. The mpgcd(a,b,c)
function finds the greatest common divisor of the first two
arguments, returning it in the third argument. The mpmtox(
a) function provides the inverse of mpxtom(a). To release
the storage allocated by mpmtox(a) use free() (see
malloc(3C)).
Use the -lmp loader option to obtain access to these func-
tions.
FILES
/usr/lib/libmp.so shared object
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 14 Nov 2002 2
Multiple Precision Library Functions mp(3MP)
ATRIBUTE TYPE ATRIBUTE VALUE
MT-Level Unsafe
SEE ALSO
exp(3M), malloc(3C), libmp(3LIB), attributes(5)
DIAGNOSTICS
Illegal operations and running out of memory produce mes-
sages 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 compatibil-
ity, and should not be used otherwise. Use the mp*() func-
tions instead. See libmp(3LIB).
SunOS 5.11 Last change: 14 Nov 2002 3
|