X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Fnearbyintf.c;h=39c3d73b5edb3deac52d193196e34a66f00ab359;hp=e4bdb26c5c9be6aa5754944be2ec5546f9c4070d;hb=2ac580fdfe1daf9924f221dc98878ae480306bfa;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd diff --git a/src/math/nearbyintf.c b/src/math/nearbyintf.c index e4bdb26c..39c3d73b 100644 --- a/src/math/nearbyintf.c +++ b/src/math/nearbyintf.c @@ -1,11 +1,17 @@ #include -#include "libm.h" +#include -float nearbyintf(float x) { - fenv_t e; +float nearbyintf(float x) +{ +#ifdef FE_INEXACT + int e; - fegetenv(&e); + e = fetestexcept(FE_INEXACT); +#endif x = rintf(x); - fesetenv(&e); +#ifdef FE_INEXACT + if (!e) + feclearexcept(FE_INEXACT); +#endif return x; }