diff --git a/src/core/IEEE754.sol b/src/core/IEEE754.sol index 728c6ca..34c5099 100644 --- a/src/core/IEEE754.sol +++ b/src/core/IEEE754.sol @@ -63,11 +63,13 @@ library IEEE754 { }} function isPositive(float f) internal pure returns (bool) { - return float.unwrap(f) & SIGN_MASK == 0; + uint32 raw = float.unwrap(f); + return raw != 0 && raw & SIGN_MASK == 0; } function isNegative(float f) internal pure returns (bool) { - return float.unwrap(f) & SIGN_MASK != 0; + uint32 raw = float.unwrap(f); + return raw != 0 && raw & SIGN_MASK != 0; } function isZero(float f) internal pure returns (bool) {