Files
uniswap-v2/contracts/libraries/Math.sol
Noah Zinsmeister c5e9261036 bump to solc@0.5.15
2019-12-20 13:28:21 -05:00

21 lines
442 B
Solidity

pragma solidity 0.5.15;
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x <= y ? x : y;
}
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
uint x = (y + 1) / 2;
z = y;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}