From: eregontp@... Date: 2019-06-27T17:44:35+00:00 Subject: [ruby-dev:50807] [Ruby trunk Bug#15432] Float の NaN のみを含む配列比較のテスト Issue #15432 has been updated by Eregon (Benoit Daloze). It makes sense in the context of #1720. I.e., all Ruby implementations behave that way, because `Float::NAN.equal? Float::NAN` must be true, and Array#== uses an #equal? + a #== check, not just #==. I want to restore the spec and add that explanation. IMHO there is no "undefined behavior" in Ruby, there is MRI behavior and that's what other Ruby implementations have to comply to, unless proven a bug or desirable to differ. ---------------------------------------- Bug #15432: Float の NaN のみを含む配列比較のテスト https://bugs.ruby-lang.org/issues/15432#change-78914 * Author: shuujii (Shuji KOBAYASHI) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.0rc2 (2018-12-15 trunk 66408) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Float の NaN のみを含む配列比較のテストが以下にあります。 ~~~ ruby ## spec/ruby/core/array/equal_value_spec.rb:47 # As per bug #1720 it "returns false for [NaN] == [NaN]" do [nan_value].should_not == [nan_value] end ~~~ しかし、これは #1720 で未定義動作とするとなったと思うので不要ではないでしょうか。 現状では以下のようになるので意味のないテストだと思います。 ~~~ ruby [Float::NAN] == [Float::NAN] #=> true [Float::NAN] == [0/0.0] #=> false ~~~ -- https://bugs.ruby-lang.org/