fif4.c

Go to the documentation of this file.
00001 /*
00002   (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
00003   See the copyright notice in the ACK home directory, in the file "Copyright".
00004 */
00005 
00006 /* $Header: /opt/proj/minix/cvsroot/src/lib/float/fif4.c,v 1.1.1.1 2005/04/21 14:56:11 beng Exp $ */
00007 
00008 /*
00009         MULTIPLY AND DISMEMBER PARTS (FIF 4)
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                 /* do a multiply */
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);     /* "loose" low order bits */
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 }

Generated on Fri Apr 14 22:57:26 2006 for minix by  doxygen 1.4.6