Skip to main content

Math

Functions

min

function min(uint256 x, uint256 y) internal pure returns (uint256 z);

max

function max(uint256 x, uint256 y) internal pure returns (uint256 z);

sqrt

function sqrt(uint256 x) internal pure returns (uint256 z);

mulDiv

Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0

Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by Uniswap Labs also under MIT license.

function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result);