1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibJS: Drop "integral part of" language

This is an editorial change in the Temporal spec.

See: 6ec1608
This commit is contained in:
Linus Groh 2022-04-29 18:49:08 +02:00
parent cb33320814
commit 9a3014c91a
3 changed files with 6 additions and 6 deletions

View file

@ -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,

View file

@ -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).

View file

@ -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 }),