summaryrefslogtreecommitdiff
path: root/src/math/nearbyintl.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-20 19:51:11 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-20 19:51:11 -0400
commit58bf74850f5f7286dc290aa22ad982f50620a1c8 (patch)
treead1d29dbdd40b13381f860f8900f8b0673dfa689 /src/math/nearbyintl.c
parentad47d45e9da8df364cb0a61b6146d51c196c8891 (diff)
parent91c28f61f43ba029166772e8ac25808ea3c3dc98 (diff)
downloadmusl-58bf74850f5f7286dc290aa22ad982f50620a1c8.tar.gz
Merge remote branch 'nsz/master'
Diffstat (limited to 'src/math/nearbyintl.c')
-rw-r--r--src/math/nearbyintl.c11
1 files changed, 8 insertions, 3 deletions
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 <fenv.h>
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