price_to_sqrtp rounding error #50
Unanswered
Mattiatore
asked this question in
Milestone 1. First Swap
Replies: 1 comment
-
I use Python not to get precise results but to explain the math without implementing it in Solidity. So, the precision of the calculations doesn't really matter since, in later milestones, all the calculations are eventually implemented in Solidity. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the function for price_to_sqrtp I believe it suffers from the math.sqrt function precision and gives an incorrect result, using the library mpmath for python I get a result that agrees with WolframAlpha:

instead of the obtained sqrt(P_c) = 5602277097478614198912276234240
Beta Was this translation helpful? Give feedback.
All reactions