-
Notifications
You must be signed in to change notification settings - Fork 464
Upgrade exponentiation to unified operator #7153
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
Conversation
6253a22
to
8af675c
Compare
2ac5b3a
to
73dedfb
Compare
I think The problem is that to match the semantics we need to perform the modulo operation ourselves, which is quite expensive at runtime. |
Well, I guess I'll have to propose new int semantics to fix it, but that would be a pretty breaking change. It seems very weird now that all other operations use int32 coercion, but only multiplication has a different behavior. |
What is the difference, in short? |
Oh you mean |
(discussing in rescript-lang/rfcs#1) |
Also make its output to use ES7 exponentiation (`**`) operator. `**` is more concise, faster than `Math.pow()`, works well with all numeric types include bigint. We were already using it for bigint, now for int and float too.
The problem I mentioned is this doesn't meet the following requirement:
But I think we'll end up fixing the |
PR opened: #7358 |
* Upgrade exponentiation to unified operator Also make its output to use ES7 exponentiation (`**`) operator. `**` is more concise, faster than `Math.pow()`, works well with all numeric types include bigint. We were already using it for bigint, now for int and float too. * adjust parens * result into int32 * more exponentiation tests * make sure it is int32 * remove unnecessary guard for constants * add changelog * add a test * update changelog * add a failing case * fix `Ext_int.int32_pow` to behave like JavaScript
Also make its output to use ES7 exponentiation (
**
) operator.**
is more concise, faster thanMath.pow()
,works well with all numeric types include bigint.
We were already using it for bigint, now for int and float too.