From: Stefano Crocco Date: 2008-08-26T20:12:59+09:00 Subject: Re: BigDecimal with Float comparision bug. On Tuesday 26 August 2008, Maciej Tomaka wrote: > Hello, > > I have noticed that BigDecimal may fail in many cases when you try to > compare it with float: > > Float: > >> BigDecimal.new("25.0") == 25.0 > > => false > > Decimal: > >> BigDecimal.new("25.0") == 25 > > => true > > >> (1..1000).select { |d| BigDecimal.new("#{d}.0") != d.to_f }.size > > => 414 > > So 41.4% such comparisions are false!!! > > What do you think about it? > > Regards It works correctly for me (ruby 1.8.7-p72) on gentoo linux (linux 2.6.25, gcc 4.3.1). Which version of ruby are you using? Stefano