summaryrefslogtreecommitdiffstats
path: root/newlib/libm/math/sf_floor.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/math/sf_floor.c
parent51fc3813e9a9ef8079b2fbde1b12647dd3f4ac93 (diff)
downloadcygnal-16740220a22d09a1c63714d93f1efc5fbe3927f3.tar.gz
cygnal-16740220a22d09a1c63714d93f1efc5fbe3927f3.tar.bz2
cygnal-16740220a22d09a1c63714d93f1efc5fbe3927f3.zip
* 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/math/sf_floor.c')
-rw-r--r--newlib/libm/math/sf_floor.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/newlib/libm/math/sf_floor.c b/newlib/libm/math/sf_floor.c
index 787f2fdf0..9264d81e9 100644
--- a/newlib/libm/math/sf_floor.c
+++ b/newlib/libm/math/sf_floor.c
@@ -38,14 +38,15 @@ static float huge = 1.0e30;
#endif
{
__int32_t i0,j0;
- __uint32_t i;
+ __uint32_t i,ix;
GET_FLOAT_WORD(i0,x);
- j0 = ((i0>>23)&0xff)-0x7f;
+ ix = (i0&0x7fffffff);
+ j0 = (ix>>23)-0x7f;
if(j0<23) {
if(j0<0) { /* raise inexact if x != 0 */
if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */
if(i0>=0) {i0=0;}
- else if((i0&0x7fffffff)!=0)
+ else if(!FLT_UWORD_IS_ZERO(ix))
{ i0=0xbf800000;}
}
} else {
@@ -57,7 +58,7 @@ static float huge = 1.0e30;
}
}
} else {
- if(j0==0x80) return x+x; /* inf or NaN */
+ if(!FLT_UWORD_IS_FINITE(ix)) return x+x; /* inf or NaN */
else return x; /* x is integral */
}
SET_FLOAT_WORD(x,i0);