From 7a33a5c9b579cec9af8910258f4199b1a8145f2b Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Thu, 22 Jul 2021 00:25:45 +0300 Subject: [PATCH] LibJS: Use trunc instead of a static_cast in is_integral_number This ensures we return true for integers that do not fit in an i64 aka, above 9223372036854775807. (2**63 - 1) --- Userland/Libraries/LibJS/Runtime/Value.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index b694129b2a..8126660982 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -72,7 +72,7 @@ public: bool is_negative_infinity() const { return is_number() && __builtin_isinf_sign(as_double()) < 0; } bool is_positive_zero() const { return is_number() && bit_cast(as_double()) == 0; } bool is_negative_zero() const { return is_number() && bit_cast(as_double()) == NEGATIVE_ZERO_BITS; } - bool is_integral_number() const { return is_finite_number() && static_cast(as_double()) == as_double(); } + bool is_integral_number() const { return is_finite_number() && trunc(as_double()) == as_double(); } bool is_finite_number() const { if (!is_number())