1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS: Let's show a few more decimals when stringifying numeric values

I'm not sure what the correct behavior is supposed to be, but at least
this makes printing numbers show some more interesting detail for now.
This commit is contained in:
Andreas Kling 2020-04-12 10:59:29 +02:00
parent c596ef3c0e
commit ff33c5b286

View file

@ -66,7 +66,7 @@ String Value::to_string() const
// FIXME: This needs improvement.
if ((double)to_i32() == as_double())
return String::number(to_i32());
return String::format("%f", as_double());
return String::format("%.4f", as_double());
}
if (is_object())