It would be nice to have an equivalent of R\'s signif function in Ruby.
For example:
>> (11.11).signif(1) 10 >> (22.22).signif(2) 22 >
Use sprintf if you want to print trailing zeros
2.0.0-p353 :001 > sprintf "%.3f", 500 => "500.000" 2.0.0-p353 :002 > sprintf "%.4f", 500 => "500.0000" 2.0.0-p353 :003 >