From: Dave Thomas Date: 2001-03-20T13:45:54+09:00 Subject: [ruby-talk:12909] Re: differences between range and array Jim Freeze writes: > Hmmm..., yes, that makes it clearer. > I guess what bothers me now is that 2.4/0.2 is not printed by p as > 11.99999999. (12.0).to_i should never equal 11. > > Is p doing something to floats before it prints them? Nope: it's just the difference is very, very small... a = 2.4/0.2 # => 12.0 a - 12.0 # => -1.776356839e-15 sprintf "%20.20g",a # => "11.999999999999998224" Just the way the bits fall. Dave