AK: Fix double promotion error when using AK:ceil on floats

This commit is contained in:
MacDue 2022-11-23 20:46:57 +00:00 committed by Andreas Kling
parent c948777ec4
commit ce6dacbc46
Notes: sideshowbarker 2024-07-17 04:05:00 +09:00

View file

@ -760,7 +760,7 @@ constexpr T ceil(T num)
if (is_constant_evaluated()) {
if (num < NumericLimits<i64>::min() || num > NumericLimits<i64>::max())
return num;
return (static_cast<double>(static_cast<i64>(num)) == num)
return (static_cast<T>(static_cast<i64>(num)) == num)
? static_cast<i64>(num)
: static_cast<i64>(num) + ((num > 0) ? 1 : 0);
}