From ff33c5b28697ceec1bb6ff5360d9aa4981b33735 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 12 Apr 2020 10:59:29 +0200 Subject: [PATCH] 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. --- Libraries/LibJS/Runtime/Value.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index 90af4d1a26..4ca35b3f0f 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -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())