1988-04-07 11:40:46 +00:00
|
|
|
/*
|
|
|
|
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
|
|
|
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1988-04-07 11:40:46 +00:00
|
|
|
|
1988-04-07 10:57:49 +00:00
|
|
|
/*
|
1988-07-25 10:46:15 +00:00
|
|
|
MULTIPLY AND DISMEMBER PARTS (FIF 8)
|
1988-04-07 10:57:49 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "FP_types.h"
|
|
|
|
#include "FP_shift.h"
|
|
|
|
|
1993-01-05 12:06:58 +00:00
|
|
|
void
|
1989-07-25 14:21:09 +00:00
|
|
|
fif8(p,x,y)
|
1993-01-05 12:06:58 +00:00
|
|
|
DOUBLE x,y;
|
1989-07-25 14:21:09 +00:00
|
|
|
struct fif8_returns *p;
|
1988-04-07 10:57:49 +00:00
|
|
|
{
|
|
|
|
|
1988-08-03 23:31:40 +00:00
|
|
|
EXTEND e1,e2;
|
|
|
|
|
1993-01-05 12:06:58 +00:00
|
|
|
extend(&y.d[0],&e1,sizeof(DOUBLE));
|
|
|
|
extend(&x.d[0],&e2,sizeof(DOUBLE));
|
1988-08-03 23:31:40 +00:00
|
|
|
/* do a multiply */
|
|
|
|
mul_ext(&e1,&e2);
|
|
|
|
e2 = e1;
|
1993-01-05 12:06:58 +00:00
|
|
|
compact(&e2, &y.d[0], sizeof(DOUBLE));
|
1989-07-25 14:21:09 +00:00
|
|
|
if (e1.exp < 0) {
|
1993-01-05 12:06:58 +00:00
|
|
|
p->ipart.d[0] = 0;
|
|
|
|
p->ipart.d[1] = 0;
|
1989-07-25 14:21:09 +00:00
|
|
|
p->fpart = y;
|
1988-04-07 10:57:49 +00:00
|
|
|
return;
|
|
|
|
}
|
1989-07-25 14:21:09 +00:00
|
|
|
if (e1.exp > 62 - DBL_M1LEFT) {
|
|
|
|
p->ipart = y;
|
1993-01-05 12:06:58 +00:00
|
|
|
p->fpart.d[0] = 0;
|
|
|
|
p->fpart.d[1] = 0;
|
1988-04-07 10:57:49 +00:00
|
|
|
return;
|
|
|
|
}
|
1993-01-05 12:06:58 +00:00
|
|
|
b64_sft(&e1.mantissa, 63 - e1.exp);
|
|
|
|
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
|
|
|
|
compact(&e1, &(p->ipart.d[0]), sizeof(DOUBLE));
|
1993-11-24 15:37:27 +00:00
|
|
|
extend(&(p->ipart.d[0]), &e2, sizeof(DOUBLE));
|
|
|
|
extend(&y.d[0], &e1, sizeof(DOUBLE));
|
|
|
|
sub_ext(&e1, &e2);
|
|
|
|
compact(&e1, &(p->fpart.d[0]), sizeof(DOUBLE));
|
1988-04-07 10:57:49 +00:00
|
|
|
}
|