MADD(3MP) COMMAND REFERENCE MADD(3MP) NAME madd, msub, mult, mdiv, pow, rpow, gcd, invert, msqrt, sdiv - multiple precision integer arithmetic SYNOPSIS cc ... -lmp #include <mp.h> madd(a, b, c) msub(a, b, c) mult(a, b, c) mdiv(a, b, q, r) pow(a, b, m, c) gcd(a, b, c) invert(a, b, c) msqrt(a, b, r) MINT *a, *b, *c, *m, *q, rpow(a, b, c) MINT *a, *c; int b; sdiv (a, n, q, r) MINT *a, *q; int n; short *r; DESCRIPTION These routines perform arithmetic on integers of arbitrary length. The integers are stored using the defined type MINT, which is found in /usr/include/mp.h. The subroutine madd calculates the sum of its first two arguments and places the result in the third. The subroutine msub calculates the difference of its first two arguments and places the result in the third. The subroutine mult calculates the product of its first two arguments and places the result in the third. The subroutine mdiv divides its first two arguments and places the quotient in the third and the remainder in the fourth. The subroutine rpow calulates the first argument raised to the power of the second argument and places the result in the third argument. The subroutine pow calulates the first argument raised to the power of the second argument modulo the third argument, Printed 3/13/89 1
MADD(3MP) COMMAND REFERENCE MADD(3MP) and places the result in the fourth argument. The subroutine gcd calculates the greatest common divisor of the first two arguments and places the result in the third. The subroutine invert calculates the modular inverse of the first argument modulus the second argument and places it in the third. The subroutine msqrt calculates the closest perfect square that is less than or equal to the first argument and places the square root in the second argument. The difference between the first argument and the perfect square found is placed in the third argument. Thus, (`arg2' * `arg2') + `arg3' = arg1. The subroutine sdiv is the same as mdiv, except that the divisor is an integer instead of a multiple precision integer. CAVEATS All arguments should be initialized by using the subroutine itom(3mp). SEE ALSO cc(1), intro(3), itom(3mp), and mout(3mp). Printed 3/13/89 2
%%index%% na:288,156; sy:444,2408; de:2852,1321;4533,1034; ca:5567,174; se:5741,199; %%index%%000000000108