aboutsummaryrefslogtreecommitdiff
path: root/newlib/libm/common/sf_ilogb.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2001-04-04 13:33:01 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2001-04-04 13:33:01 +0000
commit16740220a22d09a1c63714d93f1efc5fbe3927f3 (patch)
tree7b24242b9b20a0ee328c94acd2c95e1a8778c944 /newlib/libm/common/sf_ilogb.c
parent51fc3813e9a9ef8079b2fbde1b12647dd3f4ac93 (diff)
downloadnewlib-16740220a22d09a1c63714d93f1efc5fbe3927f3.zip
newlib-16740220a22d09a1c63714d93f1efc5fbe3927f3.tar.gz
newlib-16740220a22d09a1c63714d93f1efc5fbe3927f3.tar.bz2
* libc/include/machine/ieeefp.h: Comment about new configuration
macros _FLT_LARGEST_EXPONENT_IS_NORMAL and _FLT_NO_DENORMALS. * libm/common/fdlib.h: Define new macros for testing floats. * libm/common/sf_*: Use them. * libm/math/ef_*: Likewise. * libm/math/sf_*: Likewise.
Diffstat (limited to 'newlib/libm/common/sf_ilogb.c')
-rw-r--r--newlib/libm/common/sf_ilogb.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/newlib/libm/common/sf_ilogb.c b/newlib/libm/common/sf_ilogb.c
index ee65594..ec59406 100644
--- a/newlib/libm/common/sf_ilogb.c
+++ b/newlib/libm/common/sf_ilogb.c
@@ -27,15 +27,14 @@
GET_FLOAT_WORD(hx,x);
hx &= 0x7fffffff;
- if(hx<0x00800000) {
- if(hx==0)
- return - INT_MAX; /* ilogb(0) = 0x80000001 */
- else /* subnormal x */
- for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1;
+ if(FLT_UWORD_IS_ZERO(hx))
+ return - INT_MAX; /* ilogb(0) = 0x80000001 */
+ if(FLT_UWORD_IS_SUBNORMAL(hx)) {
+ for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1;
return ix;
}
- else if (hx<0x7f800000) return (hx>>23)-127;
- else return INT_MAX;
+ else if (!FLT_UWORD_IS_FINITE(hx)) return INT_MAX;
+ else return (hx>>23)-127;
}
#ifdef _DOUBLE_IS_32BITS