forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfif4.fc
More file actions
executable file
·46 lines (40 loc) · 918 Bytes
/
Copy pathfif4.fc
File metadata and controls
executable file
·46 lines (40 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header$ */
/*
MULTIPLY AND DISMEMBER PARTS (FIF 4)
*/
#include "FP_types.h"
#include "FP_shift.h"
void
fif4(p,x,y)
SINGLE x,y;
struct fif4_returns *p;
{
EXTEND e1,e2;
extend(&y,&e1,sizeof(SINGLE));
extend(&x,&e2,sizeof(SINGLE));
/* do a multiply */
mul_ext(&e1,&e2);
e2 = e1;
compact(&e2,&y,sizeof(SINGLE));
if (e1.exp < 0) {
p->ipart = 0;
p->fpart = y;
return;
}
if (e1.exp > 30 - SGL_M1LEFT) {
p->ipart = y;
p->fpart = 0;
return;
}
b64_sft(&e1.mantissa, 63 - e1.exp);
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
compact(&e1,&(p->ipart),sizeof(SINGLE));
extend(&(p->ipart), &e2, sizeof(SINGLE));
extend(&y, &e1, sizeof(SINGLE));
sub_ext(&e1, &e2);
compact(&e1, &(p->fpart), sizeof(SINGLE));
}