X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Fnearbyintl.c;h=0ff4b1f9e25ec4921ce9acae1495897ffeddf259;hb=9f58d06007818c43b9504e959ef81ab5f113b374;hp=b58527c8db02ce54c8a4002b4ad40a4b0dbfc9e8;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd;p=musl diff --git a/src/math/nearbyintl.c b/src/math/nearbyintl.c index b58527c8..0ff4b1f9 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,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