-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Tighten the underflow test: make it pure and target the threshold precisely.
Mark the test pure (no state read/write).
Bound signedCoefficient to ≥1 to avoid discards.
Pin exponent to a value ≤ int32.min − 77 to deterministically exercise the lossy‑zero path.
Apply this diff:
- function testPackNegativeExponentLossyZero(int256 signedCoefficient, int256 exponent) external view {
-
exponent = bound(exponent, type(int256).min, int256(type(int32).min) - 77); -
vm.assume(signedCoefficient != 0);
- function testPackNegativeExponentLossyZero(int256 signedCoefficient, int256 exponent) external pure {
-
signedCoefficient = bound(signedCoefficient, 1, type(int256).max); -
}
exponent = bound(exponent, int256(type(int32).min) - 77, int256(type(int32).min) - 77); (Float float, bool lossless) = this.packLossyExternal(signedCoefficient, exponent); assertFalse(lossless, "lossless"); assertEq(Float.unwrap(float), Float.unwrap(LibDecimalFloat.FLOAT_ZERO), "float");
Consider adding a sibling test for the “within 1..76” underflow window to assert non‑zero, lossy pack clamped at int32.min.