From: mame@... Date: 2017-10-31T03:07:56+00:00 Subject: [ruby-core:83618] [Ruby trunk Bug#1720] [NaN] == [NaN] が true になる Issue #1720 has been updated by mame (Yusuke Endoh). Summary: ko1: `[NaN] == [NaN]` evaluates to true. This looks awkward since `NaN == NaN` is `false` and `[1] == [1.0]` is `true`. matz: `rb_equal` first checks if the two sides are the same, which causes this behavior. `NaN` is a special object since `equal?` returns true but `==` returns false. However, I don't want to make equivalence check slow for such a special case. There are some approaches to fix this issue: (1) make `NaN == NaN`, which is consistent but unnatural, (2) change `rb_equal()` not to check `equal?`, which will cause performance degradation, (3) change `rb_equal()` to handle T_FLOAT specially, which will also cause performance degradation, and (4) do nothing. ... I decide that the comparison of `NaN` and `NaN` is undefined in Ruby. ---------------------------------------- Bug #1720: [NaN] == [NaN] ��� true ��������� https://bugs.ruby-lang.org/issues/1720#change-67639 * 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: