X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Fnearbyintl.c;h=82852492f8108b875fa6c588af96aecf358475b9;hp=2906f38310b4d5359678da113fd62878f2cb05d9;hb=HEAD;hpb=93a50a26cd0f9efc59cc83daae7b2d916b327ab1 diff --git a/src/math/nearbyintl.c b/src/math/nearbyintl.c index 2906f383..82852492 100644 --- a/src/math/nearbyintl.c +++ b/src/math/nearbyintl.c @@ -10,11 +10,17 @@ long double nearbyintl(long double x) #include long double nearbyintl(long double x) { - fenv_t e; +#ifdef FE_INEXACT + #pragma STDC FENV_ACCESS ON + 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