From: "byroot (Jean Boussier) via ruby-core" Date: 2026-10-17T12:00:26+00:00 Subject: [ruby-core:127157] [Ruby Bug#22452] `rb_equal` returns true for `NaN == NaN` Issue #22452 has been reported by byroot (Jean Boussier). ---------------------------------------- Bug #22452: `rb_equal` returns true for `NaN == NaN` https://bugs.ruby-lang.org/issues/22452 * Author: byroot (Jean Boussier) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- I noticed this while trying to cleanup and simplify `rb_equal`. ```ruby >> Float::NAN == Float::NAN => false >> [Float::NAN].index(Float::NAN) => 0 ``` I would expect it to return `nil`. This bug is present on all Ruby versions, except for 2.1 to 2.4. JRuby seem to have the same behavior, but TruffleRuby correctly returns`nil` The bug seem to have been re-introduced by 6e0e067de31511cebec01d176f628442371db879 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/