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 <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
parent
a43a140ef5
commit
2a1dea8a22
@ -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)}`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user