WadMath
Author: Modified from Solmate:v6
Arithmetic library with operations for fixed-point numbers.
State Variables
WAD
uint256 internal constant WAD = 1e18;
Functions
wadMul
function wadMul(uint256 x, uint256 y) internal pure returns (uint256 z);
wadDiv
function wadDiv(uint256 x, uint256 y) internal pure returns (uint256 z);
mulDiv
Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
See https://2π.com/21/muldiv
function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result);
Parameters
Name | Type | Description |
---|---|---|
a | uint256 | The multiplicand |
b | uint256 | The multiplier |
denominator | uint256 | The divisor |
Returns
Name | Type | Description |
---|---|---|
result | uint256 | The 256-bit result |
Errors
DivideByZero
error DivideByZero();
Overflow
error Overflow();