mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:47:35 +00:00
LibJS: Support modulo(x, y) with different types
It's a bit annoying having to add '.0' to y given that it's an integral number in most cases. This turns the single template parameter T into T and U to permit that.
This commit is contained in:
parent
1ec917aa23
commit
9c209b8079
5 changed files with 15 additions and 14 deletions
|
@ -180,7 +180,7 @@ ISOYearMonth balance_iso_year_month(double year, double month)
|
|||
year += floor((month - 1) / 12);
|
||||
|
||||
// 3. Set month to (month − 1) modulo 12 + 1.
|
||||
month = modulo(month - 1, 12.0) + 1;
|
||||
month = modulo(month - 1, 12) + 1;
|
||||
|
||||
// 4. Return the Record { [[Year]]: year, [[Month]]: month }.
|
||||
return ISOYearMonth { .year = static_cast<i32>(year), .month = static_cast<u8>(month), .reference_iso_day = 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue