X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Fnearbyintf.c;h=092e9ffae56e96b7d24003ea9d34adb9b4ea6e0d;hb=2ad9cf52eb9fea12a19bcf893828e1361a0b6546;hp=07df8f540507a43580c7945d910121c026fe45ab;hpb=93a50a26cd0f9efc59cc83daae7b2d916b327ab1;p=musl diff --git a/src/math/nearbyintf.c b/src/math/nearbyintf.c index 07df8f54..092e9ffa 100644 --- a/src/math/nearbyintf.c +++ b/src/math/nearbyintf.c @@ -1,11 +1,18 @@ #include #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; }