1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

LibJS: Return -Infinity in Math.max() with no argument

This commit is contained in:
Linus Groh 2020-04-05 17:09:18 +01:00 committed by Andreas Kling
parent 8bfee015bc
commit 9e7dcaa106
Notes: sideshowbarker 2024-07-19 07:52:48 +09:00
2 changed files with 2 additions and 2 deletions

View file

@ -126,8 +126,7 @@ Value MathObject::round(Interpreter& interpreter)
Value MathObject::max(Interpreter& interpreter)
{
if (!interpreter.argument_count()) {
// FIXME: I think this should return *negative* infinity.
return js_infinity();
return Value(-js_infinity().as_double());
} else if (interpreter.argument_count() == 1) {
return interpreter.argument(0).to_number();
} else {

View file

@ -1,5 +1,6 @@
try {
assert(Math.max.length === 2);
assert(Math.max() === -Infinity);
assert(Math.max(1) === 1);
assert(Math.max(2, 1) === 2);
assert(Math.max(1, 2, 3) === 3);