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
Notes: sideshowbarker 2024-07-19 07:41:26 +09:00

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())