[audit]#8 handle sqrt coner case
This commit is contained in:
@@ -53,7 +53,7 @@ library SafeMath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sqrt(uint256 x) internal pure returns (uint256 y) {
|
function sqrt(uint256 x) internal pure returns (uint256 y) {
|
||||||
uint256 z = (x + 1) / 2;
|
uint256 z = add(x, 1) / 2;
|
||||||
y = x;
|
y = x;
|
||||||
while (z < y) {
|
while (z < y) {
|
||||||
y = z;
|
y = z;
|
||||||
|
|||||||
Reference in New Issue
Block a user