00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "FP_types.h"
00013 #include "FP_shift.h"
00014
00015 void
00016 fif4(p,x,y)
00017 SINGLE x,y;
00018 struct fif4_returns *p;
00019 {
00020
00021 EXTEND e1,e2;
00022
00023 extend(&y,&e1,sizeof(SINGLE));
00024 extend(&x,&e2,sizeof(SINGLE));
00025
00026 mul_ext(&e1,&e2);
00027 e2 = e1;
00028 compact(&e2,&y,sizeof(SINGLE));
00029 if (e1.exp < 0) {
00030 p->ipart = 0;
00031 p->fpart = y;
00032 return;
00033 }
00034 if (e1.exp > 30 - SGL_M1LEFT) {
00035 p->ipart = y;
00036 p->fpart = 0;
00037 return;
00038 }
00039 b64_sft(&e1.mantissa, 63 - e1.exp);
00040 b64_sft(&e1.mantissa, e1.exp - 63);
00041 compact(&e1,&(p->ipart),sizeof(SINGLE));
00042 extend(&(p->ipart), &e2, sizeof(SINGLE));
00043 extend(&y, &e1, sizeof(SINGLE));
00044 sub_ext(&e1, &e2);
00045 compact(&e1, &(p->fpart), sizeof(SINGLE));
00046 }