mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
LibJS: Use "%d" to stringify numeric values that are whole integers
This unbreaks a bunch of the JS tests since they were now printing all the numbers as "1.000000" instead of "1".
This commit is contained in:
parent
b71e504bba
commit
a8dc6501de
Notes:
sideshowbarker
2024-07-19 08:01:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a8dc6501de1
1 changed files with 2 additions and 0 deletions
|
@ -58,6 +58,8 @@ String Value::to_string() const
|
|||
return "NaN";
|
||||
|
||||
// FIXME: This needs improvement.
|
||||
if ((double)to_i32() == as_double())
|
||||
return String::number(to_i32());
|
||||
return String::format("%f", as_double());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue