From 83a4f2a20f83551c9147a4ca328f5cddfd51488e Mon Sep 17 00:00:00 2001 From: "A.L." Date: Wed, 1 Jan 2025 11:22:38 +0800 Subject: [PATCH] fix: #21 --- src/libraries/StableMath.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/StableMath.sol b/src/libraries/StableMath.sol index d0a14b80..ea633938 100644 --- a/src/libraries/StableMath.sol +++ b/src/libraries/StableMath.sol @@ -127,7 +127,7 @@ library StableMath { uint256 D = s; (xp0, xp1) = xp0 < xp1 ? (xp0, xp1) : (xp1, xp0); for (uint256 i = 0; i < MAX_LOOP_LIMIT; i++) { - uint256 dP = ((D * D) / xp0).fullMulDiv(D, xp1) / 4; + uint256 dP = ((D * D) / xp0).fullMulDiv(D, xp1) >> 2; prevD = D; D = ((N_A * s) / A_PRECISION + 2 * dP).fullMulDiv(D, (N_A - A_PRECISION) * D / A_PRECISION + 3 * dP); if (D.within1(prevD)) {