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
10 #include <sys/types.h>
13 #include "ieee_float.h"
15 double frexp(value
, eptr
)
23 f64p
= (struct f64
*)&value
;
26 exp
= F64_GET_EXP(f64p
);
27 if (exp
== F64_EXP_MAX
)
28 { /* Either infinity or Nan */
34 /* Either 0 or denormal */
35 if (F64_GET_MANT_LOW(f64p
) == 0 &&
36 F64_GET_MANT_HIGH(f64p
) == 0)
42 /* Multiply by 2^64 */
43 factor
= 65536.0; /* 2^16 */
44 factor
*= factor
; /* 2^32 */
45 factor
*= factor
; /* 2^64 */
48 exp
= F64_GET_EXP(f64p
);
51 exp
= exp
- F64_EXP_BIAS
- exp_bias
+ 1;
53 F64_SET_EXP(f64p
, F64_EXP_BIAS
-1);
59 * $PchId: frexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $