1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

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

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 {