ExponentialNoError
ExponentialNoErrorβ
Exp is a struct which stores decimals with a fixed precision of 18 decimal places.
Thus, if we wanted to store the 5.1, mantissa would store 5.1e18. That is:
Exp({mantissa: 5100000000000000000})
.
expScaleβ
uint256 expScale
doubleScaleβ
uint256 doubleScale
halfExpScaleβ
uint256 halfExpScale
mantissaOneβ
uint256 mantissaOne
Expβ
struct Exp {
uint256 mantissa;
}
Doubleβ
struct Double {
uint256 mantissa;
}
truncateβ
function truncate(struct ExponentialNoError.Exp exp) internal pure returns (uint256)
Truncates the given exp to a whole number value. For example, truncate(Exp{mantissa: 15 * expScale}) = 15
mul_ScalarTruncateβ
function mul_ScalarTruncate(struct ExponentialNoError.Exp a, uint256 scalar) internal pure returns (uint256)
Multiply an Exp by a scalar, then truncate to return an unsigned integer.
mul_ScalarTruncateAddUIntβ
function mul_ScalarTruncateAddUInt(struct ExponentialNoError.Exp a, uint256 scalar, uint256 addend) internal pure returns (uint256)
Multiply an Exp by a scalar, truncate, then add an to an unsigned integer, returning an unsigned integer.
lessThanExpβ
function lessThanExp(struct ExponentialNoError.Exp left, struct ExponentialNoError.Exp right) internal pure returns (bool)
Checks if first Exp is less than second Exp.
lessThanOrEqualExpβ
function lessThanOrEqualExp(struct ExponentialNoError.Exp left, struct ExponentialNoError.Exp right) internal pure returns (bool)
Checks if left Exp <= right Exp.
greaterThanExpβ
function greaterThanExp(struct ExponentialNoError.Exp left, struct ExponentialNoError.Exp right) internal pure returns (bool)
Checks if left Exp > right Exp.
isZeroExpβ
function isZeroExp(struct ExponentialNoError.Exp value) internal pure returns (bool)
returns true if Exp is exactly zero
safe224β
function safe224(uint256 n, string errorMessage) internal pure returns (uint224)
safe32β
function safe32(uint256 n, string errorMessage) internal pure returns (uint32)
add_β
function add_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)
add_β
function add_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)
add_β
function add_(uint256 a, uint256 b) internal pure returns (uint256)
add_β
function add_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)
sub_β
function sub_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)
sub_β
function sub_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)
sub_β
function sub_(uint256 a, uint256 b) internal pure returns (uint256)
sub_β
function sub_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)
mul_β
function mul_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)
mul_β
function mul_(struct ExponentialNoError.Exp a, uint256 b) internal pure returns (struct ExponentialNoError.Exp)
mul_β
function mul_(uint256 a, struct ExponentialNoError.Exp b) internal pure returns (uint256)
mul_β
function mul_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)
mul_β
function mul_(struct ExponentialNoError.Double a, uint256 b) internal pure returns (struct ExponentialNoError.Double)
mul_β
function mul_(uint256 a, struct ExponentialNoError.Double b) internal pure returns (uint256)
mul_β
function mul_(uint256 a, uint256 b) internal pure returns (uint256)
mul_β
function mul_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)
div_β
function div_(struct ExponentialNoError.Exp a, struct ExponentialNoError.Exp b) internal pure returns (struct ExponentialNoError.Exp)
div_β
function div_(struct ExponentialNoError.Exp a, uint256 b) internal pure returns (struct ExponentialNoError.Exp)
div_β
function div_(uint256 a, struct ExponentialNoError.Exp b) internal pure returns (uint256)
div_β
function div_(struct ExponentialNoError.Double a, struct ExponentialNoError.Double b) internal pure returns (struct ExponentialNoError.Double)
div_β
function div_(struct ExponentialNoError.Double a, uint256 b) internal pure returns (struct ExponentialNoError.Double)
div_β
function div_(uint256 a, struct ExponentialNoError.Double b) internal pure returns (uint256)
div_β
function div_(uint256 a, uint256 b) internal pure returns (uint256)
div_β
function div_(uint256 a, uint256 b, string errorMessage) internal pure returns (uint256)
fractionβ
function fraction(uint256 a, uint256 b) internal pure returns (struct ExponentialNoError.Double)