lib/benchmark_driver/output/compare.rb in benchmark_driver-0.9.0 vs lib/benchmark_driver/output/compare.rb in benchmark_driver-0.9.1
- old
+ new
@@ -108,9 +108,11 @@
if value < 0
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
+
prefix = "%#{width}.3f" % (value.to_f / (1000 ** scale))
suffix =
case scale
when 1; 'k'
when 2; 'M'