X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2Fnearbyintl.c;h=82852492f8108b875fa6c588af96aecf358475b9;hp=b58527c8db02ce54c8a4002b4ad40a4b0dbfc9e8;hb=HEAD;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd diff --git a/src/math/nearbyintl.c b/src/math/nearbyintl.c index b58527c8..82852492 100644 --- a/src/math/nearbyintl.c +++ b/src/math/nearbyintl.c @@ -1,4 +1,6 @@ -#include "libm.h" +#include +#include + #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double nearbyintl(long double x) { @@ -8,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