-
Notifications
You must be signed in to change notification settings - Fork 32
Support RoundNumberToIncrementAsIfPositive #440
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
0da8085 to
5a93fdf
Compare
5a93fdf to
a309120
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks good.
Removing Round is probably a good idea. I think it was probably tech debt from the initial implementation.
| unsigned_rounding_mode: UnsignedRoundingMode, | ||
| ) -> u128 { | ||
| ) -> i128 { | ||
| // (x is dividend / divisor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Good comment. If you want to expand, it's primarily because x is assumed to be a float. So x is not passed in because we deal with integers and the remainder would be lost.
The spec often deals in ns values without checking for validity; e.g. in Duration.total. Fixes or makes progress on these tests (Some also need #440) ``` 'built-ins/Temporal/Duration/compare/relativeto-string-limits': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-string-limits': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-sub-minute-offset': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/result-out-of-range-3': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-string-limits': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-sub-minute-offset': [FAIL], 'built-ins/Temporal/PlainMonthDay/prototype/toPlainDate/default-overflow-behaviour': [FAIL], 'built-ins/Temporal/PlainYearMonth/compare/compare-reference-day': [FAIL], 'built-ins/Temporal/PlainYearMonth/prototype/equals/compare-reference-day': [FAIL], 'built-ins/Temporal/PlainYearMonth/prototype/toPlainDate/default-overflow-behaviour': [FAIL], 'built-ins/Temporal/ZonedDateTime/compare/argument-string-limits': [FAIL], 'built-ins/Temporal/ZonedDateTime/from/argument-string-limits': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/equals/argument-string-limits': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/since/argument-string-limits': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/until/argument-string-limits': [FAIL], ```
Fixes #383
This basically required rewriting the round code to stop assuming that everything is positive. I'm not 100% sure of the correctness, but the tests help.
Can be reviewed commit-by-commit.