From: Phrogz Date: 2007-03-20T04:50:11+09:00 Subject: Re: truncate trouble On Mar 19, 1:37 pm, "Greg Lorriman" wrote: > This > > ('40.12'.to_f*100).to_i > > results in this integer : > > 4011 What I find interesting is that the #inspect result of both f1 and f2 below are the same, when they internally are clearly not. irb(main):001:0> f1 = '40.12'.to_f => 40.12 irb(main):002:0> f1*100 => 4012.0 irb(main):003:0> (f1*100).to_i => 4011 irb(main):004:0> (f1*100).round.to_i => 4012 irb(main):005:0> 4012.0.to_i => 4012 irb(main):006:0> f2 = '40.12000000000001'.to_f => 40.12 irb(main):007:0> (f2*100).to_i => 4012