Use libc_fe*() in 32-bit nearbyint()

* sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use
	libc_feholdexcept and libc_fesetenv.
This commit is contained in:
David S. Miller 2013-01-15 20:32:13 -08:00
parent 357679d2fc
commit 438ebba294

View File

@ -44,10 +44,10 @@ double __nearbyint(double x)
j0 = ((i0>>20)&0x7ff)-0x3ff; j0 = ((i0>>20)&0x7ff)-0x3ff;
if(j0<52) { if(j0<52) {
if(j0<0) { if(j0<0) {
feholdexcept (&env); libc_feholdexcept (&env);
w = TWO52[sx]+x; w = TWO52[sx]+x;
t = w-TWO52[sx]; t = w-TWO52[sx];
fesetenv (&env); libc_fesetenv (&env);
GET_HIGH_WORD(i0,t); GET_HIGH_WORD(i0,t);
SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31)); SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
return t; return t;
@ -56,10 +56,10 @@ double __nearbyint(double x)
if(j0==0x400) return x+x; /* inf or NaN */ if(j0==0x400) return x+x; /* inf or NaN */
else return x; /* x is integral */ else return x; /* x is integral */
} }
feholdexcept (&env); libc_feholdexcept (&env);
w = TWO52[sx]+x; w = TWO52[sx]+x;
t = w-TWO52[sx]; t = w-TWO52[sx];
fesetenv (&env); libc_fesetenv (&env);
return t; return t;
} }
weak_alias (__nearbyint, nearbyint) weak_alias (__nearbyint, nearbyint)