diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2001-04-04 13:33:01 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2001-04-04 13:33:01 +0000 |
commit | 16740220a22d09a1c63714d93f1efc5fbe3927f3 (patch) | |
tree | 7b24242b9b20a0ee328c94acd2c95e1a8778c944 /newlib/libm/common/sf_rint.c | |
parent | 51fc3813e9a9ef8079b2fbde1b12647dd3f4ac93 (diff) | |
download | cygnal-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/common/sf_rint.c')
-rw-r--r-- | newlib/libm/common/sf_rint.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/newlib/libm/common/sf_rint.c b/newlib/libm/common/sf_rint.c index d38080a5d..6459b7a4c 100644 --- a/newlib/libm/common/sf_rint.c +++ b/newlib/libm/common/sf_rint.c @@ -33,15 +33,17 @@ TWO23[2]={ #endif { __int32_t i0,j0,sx; - __uint32_t i,i1; + __uint32_t i,i1,ix; float t; volatile float w; GET_FLOAT_WORD(i0,x); sx = (i0>>31)&1; - j0 = ((i0>>23)&0xff)-0x7f; + ix = (i0&0x7fffffff); + j0 = (ix>>23)-0x7f; if(j0<23) { - if(j0<0) { - if((i0&0x7fffffff)==0) return x; + if(FLT_UWORD_IS_ZERO(ix)) + return x; + if(j0<0) { i1 = (i0&0x07fffff); i0 &= 0xfff00000; i0 |= ((i1|-i1)>>9)&0x400000; @@ -58,8 +60,9 @@ TWO23[2]={ if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0); } } else { - if(j0==0x80) return x+x; /* inf or NaN */ - else return x; /* x is integral */ + if(!FLT_UWORD_IS_FINITE(ix)) return x+x; /* inf or NaN */ + else + return x; /* x is integral */ } SET_FLOAT_WORD(x,i0); w = TWO23[sx]+x; |