Issue #3589 has been updated by Marc-Andre Lafortune. Category set to core Hi, On Wed, Jul 21, 2010 at 9:52 AM, Tomasz Wegrzanowski <redmine / ruby-lang.org> wrote: > And r1800 is wrong. 100000000000000000000000.to_f is a precise number 99999999999999991611392, > and it doesn't equal 100000000000000000000000 any more than 10.2.to_i equals 10.2. You should think of floats as a range of values. For example, the float 10.2 is a range of value and the mathematical value 10.2 is simply the one that has the smallest decimal form. That range of value does not contain 10, so in Ruby `10 != 10.2` One the other hand, the float 100000000000000000000000.to_f is a range that contains both the integer 99999999999999991611392 and the integer 100000000000000000000000. The fact that the binary representation of 100000000000000000000000.to_f corresponds to 99999999999999991611392 is not important here; one the conversion to a float is done, there is no way to know which exact number was supposed to be represented, if any. Please refer to previous discussions about floats, for instance: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/25662 -- Marc-André ---------------------------------------- http://redmine.ruby-lang.org/issues/show/3589 ---------------------------------------- http://redmine.ruby-lang.org