-
Notifications
You must be signed in to change notification settings - Fork 153
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
RoundDuration: Fractional parts of "days" variable #2540
Comments
I haven't had time to look carefully, but is this a regression from #2454? |
No, it's not a regression from that PR. |
Hey, I have some free time and want to contribute - mind if I look into this bug? |
@Mrashes thanks for the offer, that's very kind! I think that would be great. Note that #2519, #2571, and #2612 are pending to be merged once they make their way through review and gain enough test coverage, and they will affect this part of both the spec and the reference polyfill. So I'd recommend that you base your work on top of that. Probably it's best to investigate first if this can be solved with only a fix to the polyfill. I think this might also be related to @anba's test case in tc39/test262#3933. |
@ptomato On digging into this I think i'm confused - seems like all tests are passing ok. Unsure if this is related to test262 or the cookbook as well but I think that due to my inexperience in the code base. My ten cents is this should be fixed in the polyfill as the use case sounds pretty edge case and adding the fraction could be confusing in the actual spec. |
@Mrashes Thanks for taking a look and sorry I didn't respond earlier. The test cases that aren't passing are the ones that Anba provided in this issue. They aren't (yet) part of the test suite. That probably means a gap in test262 coverage, which we should address. |
This seems to no longer be a problem after merging the pending PRs that I mentioned above. We now have two variables, days (an integer) and fractionalDays (possibly not an integer) and the loops are gone. |
The following test case fails in the spec polyfill, because the fractional part of the
days
variable in RoundDuration is ignored.Relevant steps:
Note 1: This case can only happen a user-defined calendar overrides
dateAdd
, because it requires that the fractional part has a different sign than the integer part ofdays
.Note 2: Also applies to the loop conditions in steps 9-10 and the
truncate(days)
call in step 9.i.Should this be fixed in the polyfill or do we want to change the spec to keep the fractional part
result.[[Nanoseconds]] / result.[[DayLength]]
in a separate variable, so we don't have to worry about it in comparisons and thetruncate
call?Test case for the
truncate
call:The text was updated successfully, but these errors were encountered: