I think I've found a bug in the sprintf function: D:\src\ruby>ruby -v ruby 1.8.2 (2004-12-25) [i386-mswin32] D:\src\ruby>irb irb(main):001:0> sprintf("%.1f", 123456789012345678.to_f) => "123456789012345680.0" irb(main):002:0> sprintf("%.1f", 123456789012345678.to_f).to_i => 123456789012345680 Notice that that sprintf changed the value by an order of magnitude... Justin