.TH MP 2
.SH NAME
-mpsetminbits, mpnew, mpfree, mpbits, mpnorm, mpcopy, mpassign, mprand, mpnrand, strtomp, mpfmt,mptoa, betomp, mptobe, mptober, letomp, mptole, mptolel, mptoui, uitomp, mptoi, itomp, uvtomp, mptouv, vtomp, mptov, mptod, dtomp, mpdigdiv, mpadd, mpsub, mpleft, mpright, mpmul, mpexp, mpmod, mpmodadd, mpmodsub, mpmodmul, mpdiv, mpcmp, mpsel, mpextendedgcd, mpinvert, mpsignif, mplowbits0, mpvecdigmuladd, mpvecdigmulsub, mpvecadd, mpvecsub, mpveccmp, mpvecmul, mpmagcmp, mpmagadd, mpmagsub, crtpre, crtin, crtout, crtprefree, crtresfree \- extended precision arithmetic
+mpsetminbits, mpnew, mpfree, mpbits, mpnorm, mpcopy, mpassign, mprand, mpnrand, strtomp, mpfmt, mptoa, betomp, mptobe, mptober, letomp, mptole, mptolel, mptoui, uitomp, mptoi, itomp, uvtomp, mptouv, vtomp, mptov, mptod, dtomp, mpdigdiv, mpadd, mpsub, mpleft, mpright, mpmul, mpexp, mpmod, mpmodadd, mpmodsub, mpmodmul, mpdiv, mpcmp, mpsel, mpfactorial, mpextendedgcd, mpinvert, mpsignif, mplowbits0, mpvecdigmuladd, mpvecdigmulsub, mpvecadd, mpvecsub, mpveccmp, mpvecmul, mpmagcmp, mpmagadd, mpmagsub, crtpre, crtin, crtout, crtprefree, crtresfree \- extended precision arithmetic
.SH SYNOPSIS
.B #include <u.h>
.br
void mpsel(int s, mpint *b1, mpint *b2, mpint *res)
.PP
.B
+mpint* mpfactorial(ulong n)
+.PP
+.B
void mpextendedgcd(mpint *a, mpint *b, mpint *d, mpint *x,
.br
.B
.B mpint
representations using the base indicated.
Only the bases 2, 4, 8, 10, 16, 32, and 64 are
-supported. Base 0 defaults to 16.
+supported.
.IR Strtomp
skips any leading spaces or tabs.
.IR Strtomp 's
return
.BR nil .
.I Mptoa
-returns a pointer to the filled buffer.
+returns a pointer to the
+.SM ASCII
+filled buffer.
If the parameter
.I buf
is
.BR nil ,
the buffer is allocated.
+Setting
+.I base
+to zero uses hexadecimal default.
.I Mpfmt
can be used with
.IR fmtinstall (2)
and
.IR print (2)
-to print hexadecimal representations of
+to print
+.SM ASCII
+representations of
.BR mpint s.
The conventional verb is
.LR B ,
.I mp.h
provides a
.LR pragma .
+The precision in the format string changes the base,
+defaulting to hexadecimal when omited.
.PP
.I Mptobe
and
returns infinity of the appropriate sign.
.PP
The mathematical functions are:
-.TF mpmagadd
+.TF mpfactorial
.TP
.I mpadd
.BR "sum = b1 + b2" .
.I b2
is assigned to
.IR res .
+.TP
+.I mpfactorial
+returns \fIn\fR!.
.PD
.PP
Logical operations (treating negative numbers using two's complement):