diff options
author | Szabolcs Nagy <nsz@port70.net> | 2018-09-10 19:06:21 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-10-10 16:15:51 -0400 |
commit | 7b384c42b73ca1a1e150b3f255990ec53cedec60 (patch) | |
tree | ae13df6b4a44b1f6fa919fbdf9f57cafdca0f57f /src/fenv | |
parent | b3389bbfb58697623621c70fade6e239952d0813 (diff) | |
download | musl-7b384c42b73ca1a1e150b3f255990ec53cedec60.tar.gz musl-7b384c42b73ca1a1e150b3f255990ec53cedec60.tar.bz2 musl-7b384c42b73ca1a1e150b3f255990ec53cedec60.tar.xz musl-7b384c42b73ca1a1e150b3f255990ec53cedec60.zip |
fix fesetround error checking
Rounding modes are not bit flags, but arbitrary non-negative integers.
Diffstat (limited to 'src/fenv')
-rw-r--r-- | src/fenv/fesetround.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/fenv/fesetround.c b/src/fenv/fesetround.c index 50e58f11..4e2f164d 100644 --- a/src/fenv/fesetround.c +++ b/src/fenv/fesetround.c @@ -7,18 +7,17 @@ hidden int __fesetround(int); int fesetround(int r) { - if (r & ~( - FE_TONEAREST + if (r != FE_TONEAREST #ifdef FE_DOWNWARD - |FE_DOWNWARD + && r != FE_DOWNWARD #endif #ifdef FE_UPWARD - |FE_UPWARD + && r != FE_UPWARD #endif #ifdef FE_TOWARDZERO - |FE_TOWARDZERO + && r != FE_TOWARDZERO #endif - )) + ) return -1; return __fesetround(r); } |