1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +00:00

LibJS: The Math.ceil() of a number between -1 and 0 should be -0,

according to the spec.
This commit is contained in:
Melissa Goad 2020-08-03 14:02:13 -05:00 committed by Andreas Kling
parent aaa13e5739
commit 192b2383ac

View file

@ -129,6 +129,9 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::ceil)
return {};
if (number.is_nan())
return js_nan();
auto number_double = number.as_double();
if (number_double < 0 && number_double > -1)
return Value(-0.f);
return Value(::ceil(number.as_double()));
}