diff options
Diffstat (limited to 'sysdeps/ieee754/flt-32/s_nearbyintf.c')
-rw-r--r-- | sysdeps/ieee754/flt-32/s_nearbyintf.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c index 7d6f262f51..04ef9ab20c 100644 --- a/sysdeps/ieee754/flt-32/s_nearbyintf.c +++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c @@ -19,22 +19,14 @@ #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const float -#else -static float -#endif TWO23[2]={ 8.3886080000e+06, /* 0x4b000000 */ -8.3886080000e+06, /* 0xcb000000 */ }; -#ifdef __STDC__ - float __nearbyintf(float x) -#else - float __nearbyintf(x) - float x; -#endif +float +__nearbyintf(float x) { fenv_t env; int32_t i0,j0,sx; @@ -50,13 +42,13 @@ TWO23[2]={ i0 &= 0xfff00000; i0 |= ((i1|-i1)>>9)&0x400000; SET_FLOAT_WORD(x,i0); - feholdexcept (&env); - w = TWO23[sx]+x; - t = w-TWO23[sx]; - fesetenv (&env); + libc_feholdexceptf (&env); + w = TWO23[sx]+x; + t = w-TWO23[sx]; + libc_fesetenvf (&env); GET_FLOAT_WORD(i0,t); SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31)); - return t; + return t; } else { i = (0x007fffff)>>j0; if((i0&i)==0) return x; /* x is integral */ @@ -64,14 +56,14 @@ TWO23[2]={ if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0); } } else { - if(j0==0x80) return x+x; /* inf or NaN */ + if(__builtin_expect(j0==0x80, 0)) return x+x; /* inf or NaN */ else return x; /* x is integral */ } SET_FLOAT_WORD(x,i0); - feholdexcept (&env); + libc_feholdexceptf (&env); w = TWO23[sx]+x; t = w-TWO23[sx]; - fesetenv (&env); + libc_fesetenvf (&env); return t; } weak_alias (__nearbyintf, nearbyintf) |