s_frexp.c (2dcc228679cb39677331f1064bedb9eac825a52f) | s_frexp.c (59b19ff14a36bb975819fff8c7bd8648a9b29537) |
---|---|
1/* @(#)s_frexp.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice --- 16 unchanged lines hidden (view full) --- 25 */ 26 27#include "math.h" 28#include "math_private.h" 29 30static const double 31two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ 32 | 1/* @(#)s_frexp.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice --- 16 unchanged lines hidden (view full) --- 25 */ 26 27#include "math.h" 28#include "math_private.h" 29 30static const double 31two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ 32 |
33 double frexp(double x, int *eptr) | 33double 34frexp(double x, int *eptr) |
34{ 35 int32_t hx, ix, lx; 36 EXTRACT_WORDS(hx,lx,x); 37 ix = 0x7fffffff&hx; 38 *eptr = 0; 39 if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */ 40 if (ix<0x00100000) { /* subnormal */ 41 x *= two54; 42 GET_HIGH_WORD(hx,x); 43 ix = hx&0x7fffffff; 44 *eptr = -54; 45 } 46 *eptr += (ix>>20)-1022; 47 hx = (hx&0x800fffff)|0x3fe00000; 48 SET_HIGH_WORD(x,hx); 49 return x; 50} | 35{ 36 int32_t hx, ix, lx; 37 EXTRACT_WORDS(hx,lx,x); 38 ix = 0x7fffffff&hx; 39 *eptr = 0; 40 if(ix>=0x7ff00000||((ix|lx)==0)) return x; /* 0,inf,nan */ 41 if (ix<0x00100000) { /* subnormal */ 42 x *= two54; 43 GET_HIGH_WORD(hx,x); 44 ix = hx&0x7fffffff; 45 *eptr = -54; 46 } 47 *eptr += (ix>>20)-1022; 48 hx = (hx&0x800fffff)|0x3fe00000; 49 SET_HIGH_WORD(x,hx); 50 return x; 51} |