-
-
Notifications
You must be signed in to change notification settings - Fork 670
Simplify Math.signbit. Don't ignore sign bit for NaNs #1467
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
Does this align with https://github.com/tc39/proposal-Math.signbit? |
|
My thinking is mostly that the introduction of |
That proposal is not standard and nobody except me it seems interested to move that proposal forward. Anyway even if AS implementation will be slightly different I don't think it broke any code now and in future. First of all signed nans is really rare case, also I don't think somebody will build his logic around sign / non-sign NaNs=) Also proposed behaviour align with other languages which not exclude sign NaNs and just extract sign bit |
But I'm ok to leave old behaviour (and close this PR) as more JavaScript way which prefer don't distinguish NaN sign) |
Is an interesting situation. Like, the motivation to propose it for JS is that there is no good alternative, and NaN canonicalization is merely a side-effect. Our motivation, however, is to provide it for compatibility with JS, but we don't really do NaN canonicalization. Now, users probably won't care about NaN canonicalization that much, they just want the sign bit. In turn, the question relevant to us becomes "what is the sign of NaN?" independently of canonicalization, leading us here. Interesting. |
The radical but also most straight-forward solution here is to document that "AssemblyScript doesn't do NaN canonicalization", then merging this PR. So, slightly in favor of making this change. Can you add a new comment? |
For example |
It's not formally correct due to |
🎉 This PR is included in version 0.14.12 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I don't think we should ignore sign for NaNs due to signed
-NaN
is actually valid and canonical.