Skip to content

Commit

Permalink
benchmark: output JSON-compatible numbers
Browse files Browse the repository at this point in the history
This is to simplify the implementation of a JavaScript version of the
compare.R script.

PR-URL: #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>
  • Loading branch information
targos authored and richardlau committed Jul 20, 2021
1 parent eb91932 commit 86477b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion benchmark/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`;
Expand Down

0 comments on commit 86477b2

Please sign in to comment.