1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57: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

@ -1582,19 +1582,19 @@ String temporal_duration_to_string(double years, double months, double weeks, do
// 1. 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);
// 2. Set microseconds to microseconds + RoundTowardsZero(nanoseconds / 1000).
// 2. Set microseconds to microseconds + truncate(nanoseconds / 1000).
microseconds += trunc(nanoseconds / 1000);
// 3. Set nanoseconds to remainder(nanoseconds, 1000).
nanoseconds = fmod(nanoseconds, 1000);
// 4. Set milliseconds to milliseconds + RoundTowardsZero(microseconds / 1000).
// 4. Set milliseconds to milliseconds + truncate(microseconds / 1000).
milliseconds += trunc(microseconds / 1000);
// 5. Set microseconds to remainder(microseconds, 1000).
microseconds = fmod(microseconds, 1000);
// 6. Set seconds to seconds + RoundTowardsZero(milliseconds / 1000).
// 6. Set seconds to seconds + truncate(milliseconds / 1000).
seconds += trunc(milliseconds / 1000);
// 7. Set milliseconds to remainder(milliseconds, 1000).