Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/lib/implementation/LibDecimalFloatImplementation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -1008,6 +1008,7 @@ library LibDecimalFloatImplementation {
}
}

/// First 4 digits of the mantissa and whether we need to interpolate.
Comment thread
thedavidmeister marked this conversation as resolved.
function mantissa4(int256 signedCoefficient, int256 exponent) internal pure returns (int256, bool, int256) {
unchecked {
if (exponent == -4) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Comment thread
thedavidmeister marked this conversation as resolved.
return (x, exponent);
}

Expand Down
Loading