Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mp(3X) — SunOS 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

MP(3X)  —  MISCELLANEOUS FUNCTIONS

NAME

itom, madd, msub, mult, mdiv, min, mout, pow, gcd, rpow − multiple precision integer arithmetic

SYNOPSIS

#include <mp.h>
madd(a, b, c)
MINT ∗a, ∗b, ∗c;
msub(a, b, c)
MINT ∗a, ∗b, ∗c;
mult(a, b, c)
MINT ∗a, ∗b, ∗c;
mdiv(a, b, q, r)
MINT ∗a, ∗b, ∗q, ∗r;
min(a)
MINT ∗a;
mout(a)
MINT ∗a;
pow(a, b, c, d)
MINT ∗a, ∗b, ∗c, ∗d;
gcd(a, b, c)
MINT ∗a, ∗b, ∗c;
rpow(a, n, b)
MINT ∗a, ∗b;
short n;
msqrt(a, b, r)
MINT ∗a, ∗b, ∗r;
sdiv(a, n, q, r)
MINT ∗a, ∗q;
short n, ∗r;
MINT ∗itom(n)
short n;

DESCRIPTION

These routines 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 itom, which sets the initial value to n. After that space is managed automatically by the routines.

Madd, msub and mult assign to their third arguments the sum, difference, and product, 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 produces the square root and remainder of its first argument.  Rpow calculates a raised to the power b, while pow calculates this reduced modulo m. Min and mout do decimal input and output. 

Use the −lmp loader option to obtain access to these functions. 

DIAGNOSTICS

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

FILES

/usr/lib/libmp.a

Sun Release 3.0β  —  Last change: 15 March 1984

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026