-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Allow negative inputs in the pow
function
#52
Comments
Hey! thanks for sharing your feedback. Supporting negative bases for the I'll see what I can do about this. In the meantime, could you share what is the use case? What do you need negative bases for? |
Thanks for the response. Basically I'm implementing a function that takes two That being said I understand that it might lead to more gas consumption but I'm sure there are usecases where this is just the way to go. |
pow
functionpow
function
pow
functionpow
function
Maybe it should take an unsigned integer for We have been breaking our heads here as to why Also, good job with the lib, thanks for publishing it! We have been breaking our heads as to why some functions would return numbers after dividing them by 1018, while others don't? |
Hey @PinkFromTheFuture, thanks for the feedback and I'm sorry you had a negative experience with some of the functions of PRBMath. I invested a lot of effort into documenting each and every function with thoughtful NatSpec comments, plus code comments within the function body. I encourage you to take a look at the source code - all of the function parameters are annotated: Regarding your comment about "plain numbers" - it's really only the I don't have a dedicated documentation website for PRBMath at the moment, though I might create one if I keep getting requests for one. In the meantime, if you have any specific questions regarding how to use PRBMath, feel free to post them in the Discussions channel. I will try to answer as soon as I can. |
pow
functionpow
function
Hi there,
I'm trying to use the
pow
function of thePRBMathSD59x18
library but with a negative x as input.Would be interesting if that could be implemented as powering a negative integer totally makes sense but is currently forbidden because of the usage of
log2
on x.Thanks !
The text was updated successfully, but these errors were encountered: