Skip to main content

FullMath

FullMath#

Functions#

mulDiv(uint256 a, uint256 b, uint256 denominator) → uint256 result (internal)

Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0

Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv

Parameters:#

  • a: The multiplicand
  • b: The multiplier
  • denominator: The divisor
mulDivRoundingUp(uint256 a, uint256 b, uint256 denominator) → uint256 result (internal)

/ @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0

Parameters:#

  • a: The multiplicand
  • b: The multiplier
  • denominator: The divisor