Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 11615f86705a3ca40514087f48cac4c05a3abb0a
      
https://github.com/WebKit/WebKit/commit/11615f86705a3ca40514087f48cac4c05a3abb0a
  Author: Yijia Huang <[email protected]>
  Date:   2026-08-10 (Mon, 10 Aug 2026)

  Changed paths:
    A JSTests/stress/temporal-duration-round-day-exact.js
    A JSTests/stress/temporal-nudge-to-calendar-unit-exact-total.js
    A JSTests/stress/temporal-nudge-to-day-or-time-exact-whole-days.js
    M Source/JavaScriptCore/API/tests/TemporalCoreTest.cpp
    M Source/JavaScriptCore/runtime/TemporalDuration.cpp
    M Source/JavaScriptCore/runtime/temporal/core/DurationArithmetic.cpp
    M Source/JavaScriptCore/runtime/temporal/core/Rounding.cpp
    M Source/JavaScriptCore/runtime/temporal/core/Rounding.h

  Log Message:
  -----------
  [JSC][Temporal] Decide duration rounding on exact integers, not doubles
https://bugs.webkit.org/show_bug.cgi?id=321407
rdar://184472920

Reviewed by Sosuke Suzuki.

Three rounding paths decided on a double that had already lost the distinction 
the
decision rests on.

    until("2000-02-29T00:01", month/hour/ceil)           P1M   -> P29DT1H
    until("2008-05-01T00:00:00.000000001", month/ceil)   P100M -> P101M
    {days: 255, nanoseconds: 1} day/ceil                 P255D -> P256D
    254d23:59:59.999999999 day/floor                     P255D -> P254D

NudgeToDayOrTime read its whole-day counts from totalTimeDuration, which rounds 
rather
than truncates. NudgeToCalendarUnit and Duration.prototype.round's 'day' branch 
rounded a
double where the spec's value is exact. All three now decide on Int128.

ApplyUnsignedRoundingMode existed twice, over doubles and over Int128 with a 
precomputed
comparison, and all three callers implemented steps 1 and 6-10 themselves. It 
is now one
function taking x as an exact rational. Its half-even branch divided r1 by 2, 
correct only
when r2 - r1 is 1, and now divides by r2 - r1 per step 14.

Tests: JSTests/stress/temporal-duration-round-day-exact.js
       JSTests/stress/temporal-nudge-to-calendar-unit-exact-total.js
       JSTests/stress/temporal-nudge-to-day-or-time-exact-whole-days.js
       Source/JavaScriptCore/API/tests/TemporalCoreTest.cpp

Canonical link: https://commits.webkit.org/318901@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to