lib/benchmark_driver/output/simple.rb in benchmark_driver-0.14.4 vs lib/benchmark_driver/output/simple.rb in benchmark_driver-0.14.5
- old
+ new
@@ -84,19 +84,18 @@
elsif value < 0
raise ArgumentError.new("Negative value: #{value.inspect}")
end
scale = (Math.log10(value) / 3).to_i
- prefix = "%6.3f" % (value.to_f / (1000 ** scale))
+ prefix = "%#{NAME_LENGTH}.3f" % (value.to_f / (1000 ** scale))
suffix =
case scale
when 1; 'k'
when 2; 'M'
when 3; 'G'
when 4; 'T'
when 5; 'Q'
else # < 1000 or > 10^15, no scale or suffix
- scale = 0
return " #{prefix}"
end
"#{prefix}#{suffix}"
end
end