From: Roger Pack Date: 2010-04-10T05:16:41+09:00 Subject: [ruby-core:29400] Re: [Feature #2152] Split functionality of Float#inspect and Float#to_s > So, double have a range (between two of them) of 2e-52 ~ 10e-16. Should we then round at 15-16 digits? I think 1.9.1 does this slightly wrong, but 1.9.2 does it right: 1.9.1: >> 1.4 - 0.1 - 1.2 => 0.09999999999999986677 1.9.2: >> 1.4 - 0.1 - 1.2 => 0.09999999999999987 So whatever the 1.9.2 logic is, I guess stick with that. > > > There is no silver bullet against floating point error :-) > > "%.15f" % (1.9 + 0.7 - 0.2) #=> "2.399999999999999" Yeah I guess after you do many operations floating point operations get you. -rp