-
Notifications
You must be signed in to change notification settings - Fork 156
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
Test coverage missing for roundingMode: 'halfExpand'
in since
for negative numbers with 0.5 remainders
#1111
Comments
The existing behaviour seems correct to me. For non-Duration types we are treating "zero" as −∞ for the purposes of rounding (the principle of "zero is the Big Bang, not the Unix epoch", also from #827), effectively considering non-Duration types always positive. and that's why we treat |
roundingMode: 'nearest'
rounding incorrectly for negative numbers with 0.5 remaindersroundingMode: 'nearest'
in since
is rounding incorrectly for negative numbers with 0.5 remainders
OK, makes sense re: Instant. I updated the OP to show a repro with |
Still seems correct to me, I believe we made "zero" == "the beginning of time" for all of the non-Duration types? |
Yep, but this is a Duration being rounded, not a DateTime. Duration rounding should round away from zero for negative durations. |
BTW, should I mark these failing tests with |
|
It turned out that the failed tests in the #993 fix were my fault and were unrelated to this rounding problem, so I didn't need to skip any tests. |
Haha, looks like the problem doesn't repro anymore after #1023 and was merged. I'm not sure if that PR or @ptomato's earlier refactor of DateTime's I'll leave this issue open in case someone wants to add a test case to handle this case because it was presumably a test hole before. |
roundingMode: 'nearest'
in since
is rounding incorrectly for negative numbers with 0.5 remaindersroundingMode: 'nearest'
in since
for negative numbers with 0.5 remainders
This is a polyfill or test262 thing and not a requirement for Stage 3. |
roundingMode: 'nearest'
in since
for negative numbers with 0.5 remaindersroundingMode: 'halfExpand'
in since
for negative numbers with 0.5 remainders
I'll move this to tc39/test262#3002. |
Looks like rounding using the 'nearest' mode isn't doing away-from-zero rounding for negative 0.5 remainders. It seems to be rounding towards zero, i.e. same behavior as
Math.round()
which isn't correct per the proposal. From #827:Repro:
The text was updated successfully, but these errors were encountered: