X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Fnearbyintl.c;fp=src%2Fmath%2Fnearbyintl.c;h=0ff4b1f9e25ec4921ce9acae1495897ffeddf259;hp=2906f38310b4d5359678da113fd62878f2cb05d9;hb=91c28f61f43ba029166772e8ac25808ea3c3dc98;hpb=8c6fc860a97f79146bf5c092d5cfb90fa6d9355a diff --git a/src/math/nearbyintl.c b/src/math/nearbyintl.c index 2906f383..0ff4b1f9 100644 --- a/src/math/nearbyintl.c +++ b/src/math/nearbyintl.c @@ -10,11 +10,16 @@ long double nearbyintl(long double x) #include long double nearbyintl(long double x) { - fenv_t e; +#ifdef FE_INEXACT + int e; - fegetenv(&e); + e = fetestexcept(FE_INEXACT); +#endif x = rintl(x); - fesetenv(&e); +#ifdef FE_INEXACT + if (!e) + feclearexcept(FE_INEXACT); +#endif return x; } #endif