diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2013-10-17 16:03:24 +0200 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2013-10-17 16:03:24 +0200 |
commit | c5d5d574cbfa96d0f6c1db24d1e072c472627e41 (patch) | |
tree | 83b97e29ee65636dfe1247ea8d2344ca3f0b04b4 /sysdeps/ieee754/dbl-64/s_frexp.c | |
parent | e5c2c2d0c0315ca24cc9cd638cdb1a2d8dcc4b0d (diff) | |
download | glibc-c5d5d574cbfa96d0f6c1db24d1e072c472627e41.tar.gz |
Format floating routines.
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_frexp.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_frexp.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_frexp.c b/sysdeps/ieee754/dbl-64/s_frexp.c index 516f561a17..1b8d8500ba 100644 --- a/sysdeps/ieee754/dbl-64/s_frexp.c +++ b/sysdeps/ieee754/dbl-64/s_frexp.c @@ -28,25 +28,28 @@ static char rcsid[] = "$NetBSD: s_frexp.c,v 1.9 1995/05/10 20:47:24 jtc Exp $"; #include <math_private.h> static const double -two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ + two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ -double __frexp(double x, int *eptr) +double +__frexp (double x, int *eptr) { - int32_t hx, ix, lx; - EXTRACT_WORDS(hx,lx,x); - ix = 0x7fffffff&hx; - *eptr = 0; - if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */ - if (ix<0x00100000) { /* subnormal */ - x *= two54; - GET_HIGH_WORD(hx,x); - ix = hx&0x7fffffff; - *eptr = -54; - } - *eptr += (ix>>20)-1022; - hx = (hx&0x800fffff)|0x3fe00000; - SET_HIGH_WORD(x,hx); - return x; + int32_t hx, ix, lx; + EXTRACT_WORDS (hx, lx, x); + ix = 0x7fffffff & hx; + *eptr = 0; + if (ix >= 0x7ff00000 || ((ix | lx) == 0)) + return x; /* 0,inf,nan */ + if (ix < 0x00100000) /* subnormal */ + { + x *= two54; + GET_HIGH_WORD (hx, x); + ix = hx & 0x7fffffff; + *eptr = -54; + } + *eptr += (ix >> 20) - 1022; + hx = (hx & 0x800fffff) | 0x3fe00000; + SET_HIGH_WORD (x, hx); + return x; } weak_alias (__frexp, frexp) #ifdef NO_LONG_DOUBLE |