X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Fnearbyintf.c;h=092e9ffae56e96b7d24003ea9d34adb9b4ea6e0d;hp=07df8f540507a43580c7945d910121c026fe45ab;hb=033a9d6ad2a65ac03156b179e7c6101d2e72c4c0;hpb=93a50a26cd0f9efc59cc83daae7b2d916b327ab1 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; }