Issue #7676 has been updated by Dwain Faithfull. It appears calling eql? on array does not behave in this way: ~~~ [Float::NAN].eql? [Float::NAN] => false ~~~ Should we aim for consistency between these methods? Does it make sense for one to have an identity check and for the other not to? I believe it doesn't really make sense for == to have an identity check, as the example in #3 is not how I'd expect Ruby to behave. ---------------------------------------- Bug #7676: Comparison of Float::NAN in array behaves unexpectedly https://bugs.ruby-lang.org/issues/7676#change-56120 * Author: Simon Russell * Status: Open * Priority: Normal * Assignee: Yukihiro Matsumoto * ruby -v: ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux] * Backport: ---------------------------------------- It seems that two arrays containing Float::NAN will be considered equal ([Float::NAN] == [Float::NAN]), despite the fact that Float::NAN != Float::NAN. Tested and reproduced in 1.8.7p371, 1.9.3p362, 2.0.0preview2. (This bug can be reproduced in Ruby 1.8 as well.) Results below. 1.8.7 p371 --------- 1.8.7 :001 > nan = 0.0/0.0 => NaN 1.8.7 :002 > nan == nan => false 1.8.7 :003 > [nan] == [nan] => true 1.9.3 p362 --------- 1.9.3p362 :001 > Float::NAN == Float::NAN => false 1.9.3p362 :002 > [Float::NAN] == [Float::NAN] => true 2.0.0 preview2 -------------- 2.0.0dev :001 > Float::NAN == Float::NAN => false 2.0.0dev :002 > [Float::NAN] == [Float::NAN] => true ---Files-------------------------------- bug-7676.patch (1.67 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>