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
numeric.c
View on GitHub ↗
static VALUE
num_eql(VALUE x, VALUE y)
{
if (TYPE(x) != TYPE(y)) return Qfalse;
if (RB_TYPE_P(x, T_BIGNUM)) {
return rb_big_eql(x, y);
}
return rb_equal(x, y);
}
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