. service tells you which device it couldn't stat
[minix3.git] / lib / gnu / ieee_float / frexp.c
blob7421797c8ee5a50adea49e93ce89df1b4c8c3a1e
1 /*
2 libc/ieee_float/frexp.c
4 Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
6 Implementation of frexp that directly manipulates the exponent bits in an
7 ieee float
8 */
10 #include <sys/types.h>
11 #include <math.h>
13 #include "ieee_float.h"
15 double frexp(value, eptr)
16 double value;
17 int *eptr;
19 struct f64 *f64p;
20 int exp, exp_bias;
21 double factor;
23 f64p= (struct f64 *)&value;
24 exp_bias= 0;
26 exp= F64_GET_EXP(f64p);
27 if (exp == F64_EXP_MAX)
28 { /* Either infinity or Nan */
29 *eptr= 0;
30 return value;
32 if (exp == 0)
34 /* Either 0 or denormal */
35 if (F64_GET_MANT_LOW(f64p) == 0 &&
36 F64_GET_MANT_HIGH(f64p) == 0)
38 *eptr= 0;
39 return value;
42 /* Multiply by 2^64 */
43 factor= 65536.0; /* 2^16 */
44 factor *= factor; /* 2^32 */
45 factor *= factor; /* 2^64 */
46 value *= factor;
47 exp_bias= 64;
48 exp= F64_GET_EXP(f64p);
51 exp= exp - F64_EXP_BIAS - exp_bias + 1;
52 *eptr= exp;
53 F64_SET_EXP(f64p, F64_EXP_BIAS-1);
55 return value;
59 * $PchId: frexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $