2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
9 * ====================================================
14 * x = frexp(arg,&exp);
15 * return a double fp quantity x such that 0.5 <= |x| <1.0
16 * and the corresponding binary exponent "exp". That is
18 * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg
23 #include "math_private.h"
26 two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
28 double frexp(double x, int *eptr)
31 EXTRACT_WORDS(hx,lx,x);
34 if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */
35 if (ix<0x00100000) { /* subnormal */
41 *eptr += (ix>>20)-1022;
42 hx = (hx&0x800fffff)|0x3fe00000;
46 libm_hidden_def(frexp)