You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
2^63 * 2^50 / 2^63
In the example above, the intermediate result of 2^63 * 2^50 would overflow, while the full result of 2^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:
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: