1 /* @(#)s_frexp.c 5.1 93/09/24 */
2 /* $FreeBSD: head/lib/msun/src/s_frexp.c 176451 2008-02-22 02:30:36Z das $ */
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
11 * ====================================================
16 * x = frexp(arg,&exp);
17 * return a double fp quantity x such that 0.5 <= |x| <1.0
18 * and the corresponding binary exponent "exp". That is
20 * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg
27 #include "math_private.h"
30 two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
33 frexp(double x, int *eptr)
36 EXTRACT_WORDS(hx,lx,x);
39 if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */
40 if (ix<0x00100000) { /* subnormal */
46 *eptr += (ix>>20)-1022;
47 hx = (hx&0x800fffff)|0x3fe00000;
52 #if (LDBL_MANT_DIG == 53)
53 __weak_reference(frexp, frexpl);