fix fesetround error checking
Rounding modes are not bit flags, but arbitrary non-negative integers.
This commit is contained in:
committed by
Rich Felker
parent
b3389bbfb5
commit
7b384c42b7
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user