From: thyresias@... Date: 2020-03-21T17:05:54+00:00 Subject: [ruby-core:97570] [Ruby master Bug#16700] Inconsistent behavior of equal? between Integer and Float Issue #16700 has been updated by thyresias (Thierry Lambert). I am a bit surprised by @jeremyevans0 statement: > In short, this isn't a bug, it is expected behavior. Regardless of implementation, I think the behavior I expect is the right one: if, in binary representation, two Float numbers are identical, I would expect them to be the same object (because they are immutable). Am I missing something? ---------------------------------------- Bug #16700: Inconsistent behavior of equal? between Integer and Float https://bugs.ruby-lang.org/issues/16700#change-84723 * Author: thyresias (Thierry Lambert) * Status: Rejected * Priority: Normal * ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [i386-mingw32] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- ~~~ruby 0.equal?(0) #=> true 0.0.equal?(0.0) #=> false x = 0.0 x.equal?(x) #=> true ~~~ Since Float objects are immutable, I would expect 0.0.equal?(0.0) to be true. -- https://bugs.ruby-lang.org/ Unsubscribe: