diff --git a/src/lib/implementation/LibDecimalFloatImplementation.sol b/src/lib/implementation/LibDecimalFloatImplementation.sol index 412d865e..93a66a34 100644 --- a/src/lib/implementation/LibDecimalFloatImplementation.sol +++ b/src/lib/implementation/LibDecimalFloatImplementation.sol @@ -948,8 +948,8 @@ library LibDecimalFloatImplementation { } } - /// Sets the coefficient so that exponent is -37. Truncates the coefficient - /// if shrinking, will error on overflow when growing. + /// Sets the coefficient so that exponent is the target exponent. Truncates + /// the coefficient if shrinking, will error on overflow when growing. /// @param signedCoefficient The signed coefficient. /// @param exponent The exponent. /// @param targetExponent The target exponent. @@ -1008,6 +1008,7 @@ library LibDecimalFloatImplementation { } } + /// First 4 digits of the mantissa and whether we need to interpolate. function mantissa4(int256 signedCoefficient, int256 exponent) internal pure returns (int256, bool, int256) { unchecked { if (exponent == -4) { diff --git a/test/src/lib/implementation/LibDecimalFloatImplementation.pow10.t.sol b/test/src/lib/implementation/LibDecimalFloatImplementation.pow10.t.sol index 4e3f74bc..2739c529 100644 --- a/test/src/lib/implementation/LibDecimalFloatImplementation.pow10.t.sol +++ b/test/src/lib/implementation/LibDecimalFloatImplementation.pow10.t.sol @@ -80,8 +80,8 @@ contract LibDecimalFloatImplementationPow10Test is LogTest { function boundFloat(int224 x, int32 exponent) internal pure returns (int224, int32) { exponent = int32(bound(exponent, -76, 76)); Float a = LibDecimalFloat.packLossless(x, exponent); - vm.assume(a.gt(LibDecimalFloat.packLossless(-1e38, 0))); - vm.assume(a.lt(LibDecimalFloat.packLossless(type(int224).max, 0))); + vm.assume(a.gt(LibDecimalFloat.packLossless(type(int224).min, 9))); + vm.assume(a.lt(LibDecimalFloat.packLossless(type(int224).max, 9))); return (x, exponent); }