mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
LibJS: Implement Infinity
This commit is contained in:
parent
40b3203941
commit
543c6e00db
5 changed files with 40 additions and 0 deletions
|
@ -57,6 +57,9 @@ String Value::to_string() const
|
|||
if (is_nan())
|
||||
return "NaN";
|
||||
|
||||
if (is_infinity())
|
||||
return as_double() < 0 ? "-Infinity" : "Infinity";
|
||||
|
||||
// FIXME: This needs improvement.
|
||||
if ((double)to_i32() == as_double())
|
||||
return String::number(to_i32());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue