Pristine Ack-5.5
[Ack-5.5.git] / modules / src / flt_arith / flt_modf.c
1 /*
2   (c) copyright 1989 by the Vrije Universiteit, Amsterdam, The Netherlands.
3   See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
5
6 /* $Id: flt_modf.c,v 1.6 1994/06/24 11:15:58 ceriel Exp $ */
7
8 #include "flt_misc.h"
9
10 void
11 flt_modf(e, ipart, fpart)
12         register flt_arith *e, *ipart, *fpart;
13 {
14         if (e->flt_exp < 0) {
15                 *fpart = *e;
16                 ipart->flt_sign = 0;
17                 ipart->flt_exp = 0;
18                 ipart->m1 = ipart->m2 = 0;
19                 return;
20         }
21         if (e->flt_exp >= 63) {
22                 fpart->flt_sign = 0;
23                 fpart->flt_exp = 0;
24                 fpart->m1 = fpart->m2 = 0;
25                 *ipart = *e;
26                 return;
27         }
28         *ipart = *e;
29         /* "loose" low order bits */
30         flt_b64_sft(&(ipart->flt_mantissa), 63 - e->flt_exp);
31         flt_b64_sft(&(ipart->flt_mantissa), e->flt_exp - 63);
32         flt_sub(e, ipart, fpart);
33 }