You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alter_fp_rounding_mode makes use of fesetround in order to alter the rounding mode on various architectures
let current = fegetround();
fesetround(if UPPER { FE_UPWARD } else { FE_DOWNWARD });
let result = operation(lhs, rhs);
fesetround(current);
result
Unfortunately if operation panics, fesetround will never revert the rounding mode. Drop would be a more reliable way around this, although there are still situations where Drop may not be called
To Reproduce
No response
Expected behavior
Ideally we wouldn't modify global thread-local state at all, but I'm not sure if this can be avoided
Activity
fix: restore floating-point rounding mode after panic (apache#26412)