From 052462844615316470c3074deb0f684872d5cecb Mon Sep 17 00:00:00 2001 From: Luiz Gustavo Abou Hatem De Liz Date: Wed, 6 Mar 2024 21:18:29 -0300 Subject: [PATCH] Removing the code with less precision and uncommenting the code with more precision --- src/router/sorClass.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/router/sorClass.ts b/src/router/sorClass.ts index 5349e9e5..52a72e34 100644 --- a/src/router/sorClass.ts +++ b/src/router/sorClass.ts @@ -537,12 +537,8 @@ function iterateSwapAmountsApproximation( // 1.042818e-12 while using normal js math operations it was // 1.0428184989387553e-12. This loss of precision caused an important bug - // let weighted_average_SPaS = sumSPaSDividedByDerivativeSPaSs.div( - // sumInverseDerivativeSPaSs - // ); - const weighted_average_SPaS = bnum( - sumSPaSDividedByDerivativeSPaSs.toNumber() / - sumInverseDerivativeSPaSs.toNumber() + const weighted_average_SPaS = sumSPaSDividedByDerivativeSPaSs.div( + sumInverseDerivativeSPaSs ); swapAmounts.forEach((swapAmount, i) => {