소스 검색

LibJS: Fix incorrect use of "modulo" in balance_iso_year_month()

Linus Groh 3 년 전
부모
커밋
a3de9dcf95
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonth.cpp

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

@@ -180,7 +180,7 @@ ISOYearMonth balance_iso_year_month(double year, double month)
     year += floor((month - 1) / 12);
     year += floor((month - 1) / 12);
 
 
     // 3. Set month to (month − 1) modulo 12 + 1.
     // 3. Set month to (month − 1) modulo 12 + 1.
-    month = fmod(month - 1, 12) + 1;
+    month = modulo(month - 1, 12.0) + 1;
 
 
     // 4. Return the Record { [[Year]]: year, [[Month]]: month }.
     // 4. Return the Record { [[Year]]: year, [[Month]]: month }.
     return ISOYearMonth { .year = static_cast<i32>(year), .month = static_cast<u8>(month), .reference_iso_day = 0 };
     return ISOYearMonth { .year = static_cast<i32>(year), .month = static_cast<u8>(month), .reference_iso_day = 0 };