From af5bf0f719491ae512649658ed6056ace3990f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 23 May 2021 11:28:18 +0200 Subject: [PATCH] benchmark: output JSON-compatible numbers This is to simplify the implementation of a JavaScript version of the compare.R script. PR-URL: https://github.com/nodejs/node/pull/38778 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel Reviewed-By: Zijian Liu Reviewed-By: Anna Henningsen Reviewed-By: Anto Aravinth --- benchmark/common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/common.js b/benchmark/common.js index 3f7abf7363281d..28a317b9a1d7a4 100644 --- a/benchmark/common.js +++ b/benchmark/common.js @@ -267,7 +267,7 @@ class Benchmark { function nanoSecondsToString(bigint) { const str = bigint.toString(); const decimalPointIndex = str.length - 9; - if (decimalPointIndex < 0) { + if (decimalPointIndex <= 0) { return `0.${'0'.repeat(-decimalPointIndex)}${str}`; } return `${str.slice(0, decimalPointIndex)}.${str.slice(decimalPointIndex)}`;