instance method
Float#===
(untyped) -> bool
===(p1)
numeric.c
View on GitHub ↗
VALUE
rb_float_equal(VALUE x, VALUE y)
{
volatile double a, b;
if (RB_INTEGER_TYPE_P(y)) {
return rb_integer_float_eq(y, x);
}
else if (RB_FLOAT_TYPE_P(y)) {
b = RFLOAT_VALUE(y);
}
else {
return num_equal(x, y);
}
a = RFLOAT_VALUE(x);
return RBOOL(a == b);
}
Alias of #==
Returns true if other has the same value as self, false otherwise:
Example
2.0 == 2 # => true 2.0 == 2.0 # => true 2.0 == Rational(2, 1) # => true 2.0 == Complex(2, 0) # => true
Float::NAN == Float::NAN returns an implementation-dependent value.
Related: Float#eql? (requires other to be a Float).