fix fesetround error checking

Rounding modes are not bit flags, but arbitrary non-negative integers.
This commit is contained in:
Szabolcs Nagy
2018-10-10 16:15:51 -04:00
committed by Rich Felker
parent b3389bbfb5
commit 7b384c42b7
+5 -6
View File
@@ -7,18 +7,17 @@ hidden int __fesetround(int);
int fesetround(int r) int fesetround(int r)
{ {
if (r & ~( if (r != FE_TONEAREST
FE_TONEAREST
#ifdef FE_DOWNWARD #ifdef FE_DOWNWARD
|FE_DOWNWARD && r != FE_DOWNWARD
#endif #endif
#ifdef FE_UPWARD #ifdef FE_UPWARD
|FE_UPWARD && r != FE_UPWARD
#endif #endif
#ifdef FE_TOWARDZERO #ifdef FE_TOWARDZERO
|FE_TOWARDZERO && r != FE_TOWARDZERO
#endif #endif
)) )
return -1; return -1;
return __fesetround(r); return __fesetround(r);
} }