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:
parent
aaa13e5739
commit
192b2383ac
1 changed files with 3 additions and 0 deletions
|
@ -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()));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue