|
|
1.1 ! root 1: .TH MP 3X ! 2: .CT 2 math ! 3: .SH NAME ! 4: itom, mfree, madd, msub, mult, mdiv, sdiv, msqrt, mgcd, min, mout, ! 5: fmin, fmout, move, mcmp, ! 6: rpow, mpow \(mi multiple precision integer arithmetic ! 7: .SH SYNOPSIS ! 8: .nf ! 9: .2C ! 10: .B "#include <mp.h>" ! 11: .B "#include <stdio.h>" ! 12: .PP ! 13: .B mint *itom(n) ! 14: .B short n; ! 15: .PP ! 16: .B mfree(a) ! 17: .B mint *a; ! 18: .PP ! 19: .B madd(a, b, c) ! 20: .B mint *a, *b, *c; ! 21: .PP ! 22: .B msub(a, b, c) ! 23: .B mint *a, *b, *c; ! 24: .PP ! 25: .B mult(a, b, c) ! 26: .B mint *a, *b, *c; ! 27: .PP ! 28: .B mgcd(a, b, c) ! 29: .B mint *a, *b, *c; ! 30: .PP ! 31: .B mdiv(a, b, q, r) ! 32: .B mint *a, *b, *q, *r; ! 33: .PP ! 34: .B sdiv(a, n, q, r) ! 35: .B mint *a, *q; ! 36: .B short n, *r; ! 37: .PP ! 38: .B \& ! 39: .B msqrt(a, b, r) ! 40: .B mint *a, *b, *r; ! 41: .PP ! 42: .B rpow(a, n, c) ! 43: .B mint *a, *c; ! 44: .PP ! 45: .B mpow(a, b, m, c) ! 46: .B mint *a, *b, *m, *c; ! 47: .PP ! 48: .B move(a, b) ! 49: .B mint *a, *b; ! 50: .PP ! 51: .B mcmp(a, b) ! 52: .B mint *a, *b; ! 53: .PP ! 54: .B int min(a) ! 55: .B mint *a; ! 56: .PP ! 57: .B mout(a) ! 58: .B mint *a; ! 59: .PP ! 60: .B int fmin(a, f) ! 61: .B mint *a; ! 62: .B FILE *f; ! 63: .PP ! 64: .B fmout(a, f) ! 65: .B mint *a; ! 66: .B FILE *f; ! 67: .1C ! 68: .SH DESCRIPTION ! 69: These routines perform arithmetic on arbitrary-length integers ! 70: of defined type ! 71: .I mint. ! 72: The functions are obtained with the ! 73: .IR ld (1) ! 74: option ! 75: .BR -lmp . ! 76: .PP ! 77: Pointers to ! 78: .I mint ! 79: must be initialized using the function ! 80: .IR itom , ! 81: which sets the initial value to ! 82: .IR n . ! 83: Thereafter space is managed automatically. ! 84: The space may be freed by ! 85: .IR mfree , ! 86: making the variable uninitialized. ! 87: .PP ! 88: .I Madd, msub, mult, ! 89: and ! 90: .I mgcd ! 91: assign to their third arguments the sum, difference, ! 92: product, and greatest common divisor, respectively, of their first two arguments. ! 93: .PP ! 94: .I Mdiv ! 95: assigns the quotient and remainder, respectively, ! 96: to its third and fourth arguments. ! 97: The remainder is nonnegative and less than the divisor in magnitude. ! 98: .I Sdiv ! 99: is like ! 100: .I mdiv ! 101: except that the divisor is an ordinary integer. ! 102: .PP ! 103: .I Msqrt ! 104: assigns the square root and remainder to its second and third arguments, ! 105: respectively. ! 106: .PP ! 107: .I Rpow ! 108: calculates ! 109: .I a ! 110: raised to the power ! 111: .IR n ; ! 112: .I mpow ! 113: calculates this reduced modulo ! 114: .IR m . ! 115: .PP ! 116: .IR Move ! 117: assigns (by copying) the value of its first argument to its second argument. ! 118: .PP ! 119: .IR Mcmp ! 120: returns a negative, zero, or positive integer if the value of its ! 121: first argument is less than, ! 122: equal to, or greater than, respectively, ! 123: the value of its second argument. ! 124: .PP ! 125: .I Min ! 126: and ! 127: .I mout ! 128: do decimal conversion from ! 129: .B stdin ! 130: and to ! 131: .BR stdout , ! 132: .I fmin ! 133: and ! 134: .I fmout ! 135: use file ! 136: .IR f ; ! 137: see ! 138: .IR stdio (3). ! 139: .I Min ! 140: and ! 141: .I fmin ! 142: return ! 143: .B EOF ! 144: on end of file. ! 145: .SH DIAGNOSTICS ! 146: Illegal operations and running out of memory ! 147: produce messages and core images. ! 148: .SH BUGS ! 149: .I Itom ! 150: and ! 151: .I sdiv ! 152: fail if ! 153: .I n ! 154: is the most negative short integer.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.