benchmark: fix printing of large numbers
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 19 Dec 2014 23:03:10 +0000 (00:03 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Sat, 20 Dec 2014 01:38:47 +0000 (02:38 +0100)
Don't use Number#toPrecision(), it switches to scientific notation for
numbers with more digits than the precision; use Number#toFixed().

PR-URL: https://github.com/iojs/io.js/pull/185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
benchmark/common.js

index ff54f2e..7d1730c 100644 (file)
@@ -187,7 +187,7 @@ Benchmark.prototype.end = function(operations) {
 Benchmark.prototype.report = function(value) {
   var heading = this.getHeading();
   if (!silent)
-    console.log('%s: %s', heading, value.toPrecision(5));
+    console.log('%s: %s', heading, value.toFixed(0));
   process.exit(0);
 };