Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Numeric#eql?

num.eql?(numeric) → true or false

Returns true if num and numeric are the same type and have equal values. Contrast this with Numeric#==, which performs type conversions.

Example
1 == 1.0        #=> true
1.eql?(1.0)     #=> false
1.0.eql?(1.0)   #=> true
See also #dup #fdiv #divmod #finite? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1