Skip to content

Conversation

@Manishearth
Copy link
Contributor

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.

@Manishearth Manishearth requested a review from nekevss July 23, 2025 02:20
@Manishearth Manishearth added this to the 0.0.12 milestone Jul 23, 2025
Copy link
Member

@nekevss nekevss left a 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)
Copy link
Member

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.

@Manishearth Manishearth merged commit 71dbde1 into boa-dev:main Jul 23, 2025
8 checks passed
@Manishearth Manishearth deleted the instant-rounding branch July 23, 2025 03:53
nekevss pushed a commit that referenced this pull request Jul 25, 2025
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],
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instant should be rounded with RoundNumberToIncrementAsIfPositive

2 participants