-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
EIP-198 implement a precompile for modular exponentiation #920
Conversation
|
||
private long getMultComplexity(long x) { | ||
|
||
long x2 = (long) Math.pow(x, 2); |
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.
x * x
should be used here. Math.pow()
is double function and may return incompatible result on large numbers
E.g. Integer.MAX_VALUE * Integer.MAX_VALUE != Math.pow(Integer.MAX_VALUE, 2)
It will still end up in OOG, but anyways...
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.
yep, agree on that
Relates to #923 |
Implementation of EIP 198: ethereum/EIPs#198