Skip to content
Permalink
Browse files
[JSC] Support all rounding modes in Temporal
https://bugs.webkit.org/show_bug.cgi?id=245935

Reviewed by Geoffrey Garen.

This patch implements the rest of the rounding modes for Temporal, namely,
`expand`, `halfCeil`, `halfFloor`, `halfTrunc`, and `halfEven`.

(As a bonus, it also addresses two adjacent spec tweaks related to fractionalSecondDigits and BalanceDuration.)

Note: Some tests still fail due to precision loss beyond MAX_SAFE_INTEGER...

* JSTests/test262/config.yaml:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/TemporalDuration.cpp:
(JSC::TemporalDuration::balance):
(JSC::TemporalDuration::total const):
* Source/JavaScriptCore/runtime/TemporalDuration.h:
* Source/JavaScriptCore/runtime/TemporalObject.cpp:
(JSC::temporalFractionalSecondDigits):
(JSC::temporalRoundingMode):
(JSC::negateTemporalRoundingMode):
(JSC::roundNumberToIncrement):

Canonical link: https://commits.webkit.org/255068@main
  • Loading branch information
rkirsling committed Oct 2, 2022
1 parent 5de6ac4 commit a8f81aab31317cd32026b3f895f309e02bc9089f
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 222 deletions.
@@ -280,8 +280,13 @@ skip:
- test/built-ins/Temporal/Duration/prototype/round/relativeto-sub-minute-offset.js
- test/built-ins/Temporal/Duration/prototype/round/relativeto-wrong-type.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-ceil.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-expand.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-floor.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-halfCeil.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-halfEven.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-halfExpand.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-halfFloor.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-halfTrunc.js
- test/built-ins/Temporal/Duration/prototype/round/roundingmode-trunc.js
- test/built-ins/Temporal/Duration/prototype/round/throws-in-balance-duration-when-sign-mismatched-with-zoned-date-time.js
- test/built-ins/Temporal/Duration/prototype/round/throws-in-unbalance-duration-relative-when-sign-mismatched.js
@@ -361,8 +366,13 @@ skip:
- test/built-ins/Temporal/PlainDate/prototype/since/rounding-relative.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingincrement.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-ceil.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-expand.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-floor.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfCeil.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfEven.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfExpand.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfFloor.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfTrunc.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-trunc.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-undefined.js
- test/built-ins/Temporal/PlainDate/prototype/since/roundingmode-wrong-type.js
@@ -372,8 +382,13 @@ skip:
- test/built-ins/Temporal/PlainDate/prototype/until/rounding-relative.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingincrement.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-ceil.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-expand.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-floor.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfCeil.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfEven.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfExpand.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfFloor.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfTrunc.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-trunc.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-undefined.js
- test/built-ins/Temporal/PlainDate/prototype/until/roundingmode-wrong-type.js

0 comments on commit a8f81aa

Please sign in to comment.