divmul
Scalar function
Computes (x * d) / y using 512-bit intermediate to avoid overflow. Inverse of muldiv. Useful for price calculations.
divmul(UINT256, UINT256, UINT256)
1
SELECT divmul(token_amount, price, '1000000000000000000'::UINT256);
Notebook ready in readonly mode.
divmul(UINT256, UINT256, UINT256, TINYINT)
Returns
| Name | Type |
|---|---|
| result | UINT256 |
1
SELECT divmul(debt, rate, WAD, 1) AS debt_rounded_up;
Notebook ready in readonly mode.