IEEE754 isPositive/isNegative fixes
This commit is contained in:
@@ -63,11 +63,13 @@ library IEEE754 {
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
function isPositive(float f) internal pure returns (bool) {
|
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) {
|
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) {
|
function isZero(float f) internal pure returns (bool) {
|
||||||
|
|||||||
Reference in New Issue
Block a user