Project

General

Profile

Actions

Bug #16700

closed

Inconsistent behavior of equal? between Integer and Float

Added by thyresias (Thierry Lambert) almost 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.5p114 (2019-10-01 revision 67812) [i386-mingw32]
[ruby-core:97567]

Description

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0