2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
9 ROUTINE TO MULTIPLY TWO EXTENDED FORMAT NUMBERS
14 # include "FP_types.h"
15 # include "FP_shift.h"
21 register int i,j; /* loop control */
22 unsigned short mp[4]; /* multiplier */
23 unsigned short mc[4]; /* multipcand */
24 unsigned short result[8]; /* result */
25 register unsigned short *pres;
27 /* first save the sign (XOR) */
30 /* compute new exponent */
31 e1->exp += e2->exp + 1;
32 /* 128 bit multiply of mantissas */
34 /* assign unknown long formats */
35 /* to known unsigned word formats */
37 mp[1] = (unsigned short) e1->m1;
39 mp[3] = (unsigned short) e1->m2;
41 mc[1] = (unsigned short) e2->m1;
43 mc[3] = (unsigned short) e2->m2;
48 * fill registers with their components
50 for(i=4, pres = &result[4];i--;pres--) if (mp[i]) {
52 unsigned long mpi = mp[i];
54 unsigned long tmp = (unsigned long)pres[j] + k;
55 if (mc[j]) tmp += mpi * mc[j];
61 if (! (result[0] & 0x8000)) {
63 for (i = 0; i <= 3; i++) {
65 if (result[i+1]&0x8000) result[i] |= 1;
71 * combine the registers to a total
73 e1->m1 = ((unsigned long)(result[0]) << 16) + result[1];
74 e1->m2 = ((unsigned long)(result[2]) << 16) + result[3];
75 if (result[4] & 0x8000) {
83 /* check for overflow */
84 if (e1->exp >= EXT_MAX) {
87 /* return signed infinity */
89 infinity: e1->m1 = e1->m2 =0L;
92 /* check for underflow */
93 if (e1->exp < EXT_MIN) {