diff options
Diffstat (limited to 'libm/powerpc/s_logb.c')
-rw-r--r-- | libm/powerpc/s_logb.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libm/powerpc/s_logb.c b/libm/powerpc/s_logb.c index 3a410ba5c..23c7270f9 100644 --- a/libm/powerpc/s_logb.c +++ b/libm/powerpc/s_logb.c @@ -32,8 +32,8 @@ * Standard 754. * *******************************************************************************/ -typedef union - { +typedef union + { struct { #if defined(__BIG_ENDIAN__) unsigned long int hi; @@ -62,38 +62,38 @@ double logb ( double x ) { DblInHex xInHex; long int shiftedExp; - + xInHex.dbl = x; shiftedExp = ( xInHex.words.hi & 0x7ff00000UL ) >> 20; - - if ( shiftedExp == 2047 ) + + if ( shiftedExp == 2047 ) { // NaN or INF if ( ( ( xInHex.words.hi & signMask ) == 0 ) || ( x != x ) ) return x; // NaN or +INF return x else return -x; // -INF returns +INF } - + if ( shiftedExp != 0 ) // normal number shiftedExp -= 1023; // unbias exponent - - else if ( x == 0.0 ) + + else if ( x == 0.0 ) { // zero xInHex.words.hi = 0x0UL; // return -infinity return ( minusInf.dbl ); } - - else + + else { // subnormal number xInHex.dbl *= twoTo52; // scale up shiftedExp = ( xInHex.words.hi & 0x7ff00000UL ) >> 20; shiftedExp -= 1075; // unbias exponent } - + if ( shiftedExp == 0 ) // zero result return ( 0.0 ); - - else + + else { // nonzero result xInHex.dbl = klTod; xInHex.words.lo += shiftedExp; |