-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
(-1) % 1 evaluates to +0, not -0 #2611
Comments
https://tc39.es/ecma262/#sec-numeric-types-number-remainder suggests to me that it would reach step 7 with It seems like you're saying that step 7 produces a mathematical zero, and that step 8, for the case when |
Yes exactly.
I think it's not when Thank you for the quick reply! |
Yes, I'll do. |
Description: The abstract operation Number::remainder(n, d) returns +0𝔽 when n and d are finite and non-zero and n is divisible by d, even if n is negative. For example, when n = -1 and d = 1, algorithm step 8 returns 𝔽(0), which is +0𝔽. Accordingly, the expression (-1) % 1 evaluates to +0𝔽. This behavior is different from that of ES6 (and JS engines) in which it evaluates to -0 by the following rule in 12.6.3.3 Applying the % Operator:
eshost Output:
The text was updated successfully, but these errors were encountered: