From: eregontp@... Date: 2017-10-30T20:58:52+00:00 Subject: [ruby-core:83615] [Ruby trunk Bug#1720] [NaN] == [NaN] が true になる Issue #1720 has been updated by Eregon (Benoit Daloze). Could someone summarize in English the rationale? ~~~ ruby Float::NAN == Float::NAN # => false ~~~ The documentation says: ~~~ The result of NaN == NaN is undefined, so the implementation-dependent value is returned. ~~~ But this is true no matter the environment, isn't it? (NaN is the only numeric value never equal to itself) And then we have: ~~~ ruby [Float::NAN] == [Float::NAN] # => true [0.0/0] == [Float::NAN] # => false ~~~ Which sounds to me like a bad side effect of short-circuiting in rb_equal on ~~~ c if (a == b) return Qtrue; else return rb_funcall(a, "==", 1, b); ~~~ ---------------------------------------- Bug #1720: [NaN] == [NaN] ��� true ��������� https://bugs.ruby-lang.org/issues/1720#change-67636 * Author: tadf (tadayoshi funaba) * Status: Closed * Priority: Normal * Assignee: mrkn (Kenta Murata) * Target version: 2.0.0 * ruby -v: ruby 1.9.2dev (2009-07-03 trunk 23945) [i686-linux] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- =begin NaN = 0.0/0 [NaN] == [NaN] ��� true ��������������������� NaN == NaN #=> false [1] == [1.0] #=> true ������������������������������������������������������������������ =end -- 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>