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

LibJS: Replace RoundTowardsZero with truncate

This is an editorial change in the Temporal spec. See:
409ab66
This commit is contained in:
Timothy Flynn 2022-10-14 09:29:16 -04:00 committed by Linus Groh
parent 019211bcb4
commit 4fbec2e8b3
6 changed files with 12 additions and 12 deletions

View file

@ -450,7 +450,7 @@ ThrowCompletionOr<NanosecondsToDaysResult> nanoseconds_to_days(VM& vm, Crypto::S
// 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]]: RoundTowardsZero(nanoseconds / dayLengthNs), [[Nanoseconds]]: (abs(nanoseconds) modulo dayLengthNs) × sign, [[DayLength]]: dayLengthNs }.
// a. Return the Record { [[Days]]: truncate(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 { sign }),