diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-03-20 19:51:11 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-03-20 19:51:11 -0400 |
commit | 58bf74850f5f7286dc290aa22ad982f50620a1c8 (patch) | |
tree | ad1d29dbdd40b13381f860f8900f8b0673dfa689 /src/math/nearbyintf.c | |
parent | ad47d45e9da8df364cb0a61b6146d51c196c8891 (diff) | |
parent | 91c28f61f43ba029166772e8ac25808ea3c3dc98 (diff) | |
download | musl-58bf74850f5f7286dc290aa22ad982f50620a1c8.tar.gz musl-58bf74850f5f7286dc290aa22ad982f50620a1c8.tar.xz musl-58bf74850f5f7286dc290aa22ad982f50620a1c8.zip |
Merge remote branch 'nsz/master'
Diffstat (limited to 'src/math/nearbyintf.c')
-rw-r--r-- | src/math/nearbyintf.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/math/nearbyintf.c b/src/math/nearbyintf.c index 07df8f54..39c3d73b 100644 --- a/src/math/nearbyintf.c +++ b/src/math/nearbyintf.c @@ -1,11 +1,17 @@ #include <fenv.h> #include <math.h> -float nearbyintf(float x) { - fenv_t e; +float nearbyintf(float x) +{ +#ifdef FE_INEXACT + int e; - fegetenv(&e); + e = fetestexcept(FE_INEXACT); +#endif x = rintf(x); - fesetenv(&e); +#ifdef FE_INEXACT + if (!e) + feclearexcept(FE_INEXACT); +#endif return x; } |