소스 검색

LibJS: Drop "integral part of" language

This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6ec1608
Linus Groh 3 년 전
부모
커밋
9a3014c91a

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp

@@ -1007,7 +1007,7 @@ i64 round_number_to_increment(double x, u64 increment, StringView rounding_mode)
     }
     // 6. Else if roundingMode is "trunc", then
     else if (rounding_mode == "trunc"sv) {
-        // a. Let rounded be the integral part of quotient, removing any fractional digits.
+        // a. Let rounded be RoundTowardsZero(quotient).
         rounded = trunc(quotient);
     }
     // 7. Else,
@@ -1056,7 +1056,7 @@ BigInt* round_number_to_increment(GlobalObject& global_object, BigInt const& x,
     }
     // 6. Else if roundingMode is "trunc", then
     else if (rounding_mode == "trunc"sv) {
-        // a. Let rounded be the integral part of quotient, removing any fractional digits.
+        // a. Let rounded be the RoundTowardsZero(quotient).
         // NOTE: This is a no-op
     }
     // 7. Else,

+ 3 - 3
Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp

@@ -1590,19 +1590,19 @@ String temporal_duration_to_string(double years, double months, double weeks, do
     // 5. Let sign be ! DurationSign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds).
     auto sign = duration_sign(years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds);
 
-    // 6. Set microseconds to microseconds + the integral part of nanoseconds / 1000.
+    // 6. Set microseconds to microseconds + RoundTowardsZero(nanoseconds / 1000).
     microseconds += trunc(nanoseconds / 1000);
 
     // 7. Set nanoseconds to remainder(nanoseconds, 1000).
     nanoseconds = fmod(nanoseconds, 1000);
 
-    // 8. Set milliseconds to milliseconds + the integral part of microseconds / 1000.
+    // 8. Set milliseconds to milliseconds + RoundTowardsZero(microseconds / 1000).
     milliseconds += trunc(microseconds / 1000);
 
     // 9. Set microseconds to remainder(microseconds, 1000).
     microseconds = fmod(microseconds, 1000);
 
-    // 10. Set seconds to seconds + the integral part of milliseconds / 1000.
+    // 10. Set seconds to seconds + RoundTowardsZero(milliseconds / 1000).
     seconds += trunc(milliseconds / 1000);
 
     // 11. Set milliseconds to remainder(milliseconds, 1000).

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.cpp

@@ -453,7 +453,7 @@ ThrowCompletionOr<NanosecondsToDaysResult> nanoseconds_to_days(GlobalObject& glo
 
     // 4. If Type(relativeTo) is not Object or relativeTo does not have an [[InitializedTemporalZonedDateTime]] internal slot, then
     if (!relative_to_value.is_object() || !is<ZonedDateTime>(relative_to_value.as_object())) {
-        // a. Return the Record { [[Days]]: the integral part of nanoseconds / dayLengthNs, [[Nanoseconds]]: (abs(nanoseconds) modulo dayLengthNs) × sign, [[DayLength]]: dayLengthNs }.
+        // a. Return the Record { [[Days]]: RoundTowardsZero(nanoseconds / dayLengthNs), [[Nanoseconds]]: (abs(nanoseconds) modulo dayLengthNs) × sign, [[DayLength]]: dayLengthNs }.
         return NanosecondsToDaysResult {
             .days = nanoseconds.divided_by(day_length_ns).quotient.to_double(),
             .nanoseconds = Crypto::SignedBigInteger { nanoseconds.unsigned_value() }.divided_by(day_length_ns).remainder.multiplied_by(Crypto::SignedBigInteger { (i32)sign }),