LibJS: Don't try to store negative zero as an Int32 JS::Value

This commit is contained in:
Andreas Kling 2021-03-21 18:28:17 +01:00
parent 6870349599
commit 14d598fe7f
Notes: sideshowbarker 2024-07-18 21:10:52 +09:00

View file

@ -109,7 +109,7 @@ public:
explicit Value(double value)
{
if (value >= NumericLimits<i32>::min() && value <= NumericLimits<i32>::max() && static_cast<i32>(value) == value) {
if (value >= NumericLimits<i32>::min() && value <= NumericLimits<i32>::max() && trunc(value) == value && value != -0.0) {
m_type = Type::Int32;
m_value.as_i32 = static_cast<i32>(value);
} else {