-
Notifications
You must be signed in to change notification settings - Fork 77
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
Emulate OP_MULDIV #151
Milestone
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this BCR post OP_MULDIV is mentioned as a possible solution for overflowing intermediate values when multiplying and dividing after each other.
For example:
In the example above, the intermediate result of
2^63 * 2^50
would overflow, while the full result of2^63 * 2^50 / 2^63
would not.While OP_MULDIV doesn't exist now, some people are emulating this using division and modulo operations (e.g. the old AnyHedge).
We could abstract away this emulation into something like
muldiv(2^63, 2^50, 2^63)
. That would make this emulation that contract devs do less error prone and much easier to read because it is handled by the compiler, not the developer.The text was updated successfully, but these errors were encountered: