-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pow() fix for ud60x18 #176
Conversation
src/ud60x18/Math.sol
Outdated
else if(xUint == uUNIT) { | ||
result = UNIT; | ||
} | ||
// x^y = 1/((1/x)^y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this equation in the NatSpec comments, and use MathJax?
Thank you very much for the PR, @FoxDev12, but to merge this, tests have to be written to cover the expanded function domain: |
Sure enough. Will do when i have a little time in my hands, hopefully tomorrow. |
TY! Lint checks aren't passing; you need to make sure they do by configuring {
"editor.formatOnSave": true,
} Alternatively, you could try running |
@FoxDev12 I have recently performed a significant rebase on the The easiest way to patch this would be to cherry pick your existing commits on a new temporary branch, rename it to the current branch, and force push to remote. |
@FoxDev12 are you planning on re-opening this PR (or creating another one)? |
@PaulRBerg Apologies, i'm quite busy lately. I will reopen the PR this weekend. |
@FoxDev12 I started working on this myself. While reading your implementation, I got confused by this comment on this line:
I don't understand why that code would overflow just for small values of |
Made pow(x, y) work for x < 1. No need to replicate in sd59x18 because log2(]0,1[) is defined there.
Doesnt waste gas on doing math for 1^y when x = 1, and does 1/((1/x)^y) to get x^y when x < 1