From 14d598fe7f6c312c0c4310567c77dea796f07cff Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 21 Mar 2021 18:28:17 +0100 Subject: [PATCH] LibJS: Don't try to store negative zero as an Int32 JS::Value --- 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 4bf25007a8..fddd33cf81 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -109,7 +109,7 @@ public: explicit Value(double value) { - if (value >= NumericLimits::min() && value <= NumericLimits::max() && static_cast(value) == value) { + if (value >= NumericLimits::min() && value <= NumericLimits::max() && trunc(value) == value && value != -0.0) { m_type = Type::Int32; m_value.as_i32 = static_cast(value); } else {