Rev | Line | |
---|
[9] | 1 | /*
|
---|
| 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".
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /* $Header: /cvsup/minix/src/lib/float/fif8.c,v 1.1.1.1 2005/04/21 14:56:11 beng Exp $ */
|
---|
| 7 |
|
---|
| 8 | /*
|
---|
| 9 | MULTIPLY AND DISMEMBER PARTS (FIF 8)
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | #include "FP_types.h"
|
---|
| 13 | #include "FP_shift.h"
|
---|
| 14 |
|
---|
| 15 | void
|
---|
| 16 | fif8(p,x,y)
|
---|
| 17 | DOUBLE x,y;
|
---|
| 18 | struct fif8_returns *p;
|
---|
| 19 | {
|
---|
| 20 |
|
---|
| 21 | EXTEND e1,e2;
|
---|
| 22 |
|
---|
| 23 | extend(&y.d[0],&e1,sizeof(DOUBLE));
|
---|
| 24 | extend(&x.d[0],&e2,sizeof(DOUBLE));
|
---|
| 25 | /* do a multiply */
|
---|
| 26 | mul_ext(&e1,&e2);
|
---|
| 27 | e2 = e1;
|
---|
| 28 | compact(&e2, &y.d[0], sizeof(DOUBLE));
|
---|
| 29 | if (e1.exp < 0) {
|
---|
| 30 | p->ipart.d[0] = 0;
|
---|
| 31 | p->ipart.d[1] = 0;
|
---|
| 32 | p->fpart = y;
|
---|
| 33 | return;
|
---|
| 34 | }
|
---|
| 35 | if (e1.exp > 62 - DBL_M1LEFT) {
|
---|
| 36 | p->ipart = y;
|
---|
| 37 | p->fpart.d[0] = 0;
|
---|
| 38 | p->fpart.d[1] = 0;
|
---|
| 39 | return;
|
---|
| 40 | }
|
---|
| 41 | b64_sft(&e1.mantissa, 63 - e1.exp);
|
---|
| 42 | b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
|
---|
| 43 | compact(&e1, &(p->ipart.d[0]), sizeof(DOUBLE));
|
---|
| 44 | extend(&(p->ipart.d[0]), &e2, sizeof(DOUBLE));
|
---|
| 45 | extend(&y.d[0], &e1, sizeof(DOUBLE));
|
---|
| 46 | sub_ext(&e1, &e2);
|
---|
| 47 | compact(&e1, &(p->fpart.d[0]), sizeof(DOUBLE));
|
---|
| 48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.