-
-
Notifications
You must be signed in to change notification settings - Fork 669
Use integer power "**" operator for integer types #210
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
Comments
There is no specific reason to use floating point |
In python for integers operands, the result has the same type as the operands (after coercion) unless the second argument is negative in this case pow '**' return float result. Will be great have the same behaviour |
Do you know a good ipow (or how it's named) implementation that we could implement? :) |
Hmm, I don't know about performance of my implementation but I tried speedup ipow calculation as much as possible. We could get this as proof of concept but for smaller types implementation could be more simplicity without some extra checks. Also compiler should provide precomputing cases when all arguments is constant like |
@MaxGraey Has this been solved by your PR? |
Not yet. It require some stuff from compiler side as well. |
Closing this issue as part of 2020 vacuum as it is now tracked by the respective PR, which is nearing completion. |
It still WIP here: #1146 and will finished soon |
Closed this because I thought that having both an issue and a PR, that is nearly finished, isn't necessary. But if you prefer to keep it open, I'm ok with that :) |
Implemented in #1146 |
Once day Vitalik Buterin published this twit about one counter example in Javascript using Fermat's Last Theorem:
That's happened because JS/TS using float point numbers all the time except logical ops.
In AS we have more rich set of types but power (
**
) operator still useMath.pow
under the hood. This unfortunately cause to the same problem as in JS/TS and increase size of code btw.The text was updated successfully, but these errors were encountered: