From a8dc6501de196a1e5c2c23c29bea59f99a1e8892 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 31 Mar 2020 19:06:10 +0200 Subject: [PATCH] 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". --- Libraries/LibJS/Runtime/Value.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibJS/Runtime/Value.cpp b/Libraries/LibJS/Runtime/Value.cpp index 809f7b5756..0d731dc342 100644 --- a/Libraries/LibJS/Runtime/Value.cpp +++ b/Libraries/LibJS/Runtime/Value.cpp @@ -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()); }