X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Fnearbyintf.c;h=092e9ffae56e96b7d24003ea9d34adb9b4ea6e0d;hp=e4bdb26c5c9be6aa5754944be2ec5546f9c4070d;hb=033a9d6ad2a65ac03156b179e7c6101d2e72c4c0;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd diff --git a/src/math/nearbyintf.c b/src/math/nearbyintf.c index e4bdb26c..092e9ffa 100644 --- a/src/math/nearbyintf.c +++ b/src/math/nearbyintf.c @@ -1,11 +1,18 @@ #include -#include "libm.h" +#include -float nearbyintf(float x) { - fenv_t e; +float nearbyintf(float x) +{ +#ifdef FE_INEXACT + #pragma STDC FENV_ACCESS ON + 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; }