lib/benchmark_driver/output/compare.rb in benchmark_driver-0.14.3 vs lib/benchmark_driver/output/compare.rb in benchmark_driver-0.14.4
- old
+ new
@@ -114,13 +114,15 @@
ensure
$stdout.sync = sync
end
def humanize(value, width = 10)
- if value == BenchmarkDriver::Result::ERROR
+ if BenchmarkDriver::Result::ERROR.equal?(value)
return " %#{width}s" % 'ERROR'
+ elsif value == 0.0
+ return " %#{width}.3f" % 0.0
elsif value < 0
- raise ArgumentError.new("Non positive value: #{value.inspect}")
+ raise ArgumentError.new("Negative value: #{value.inspect}")
end
scale = (Math.log10(value) / 3).to_i
return "%#{width}s" % value.to_s if scale < 0 # like 1.23e-04