instance method
Float#<
(::Numeric) -> bool
self < other → true or false
numeric.c
View on GitHub ↗
static VALUE
flo_lt(VALUE x, VALUE y)
{
double a, b;
a = RFLOAT_VALUE(x);
if (RB_INTEGER_TYPE_P(y)) {
VALUE rel = rb_integer_float_cmp(y, x);
if (FIXNUM_P(rel))
return RBOOL(-FIX2LONG(rel) < 0);
return Qfalse;
}
else if (RB_FLOAT_TYPE_P(y)) {
b = RFLOAT_VALUE(y);
}
else {
return rb_num_coerce_relop(x, y, '<');
}
return RBOOL(a < b);
}
Returns whether the value of self is less than the value of other; other must be numeric, but may not be Complex:
Example
2.0 < 3 # => true 2.0 < 3.0 # => true 2.0 < Rational(3, 1) # => true 2.0 < 2.0 # => false
Float::NAN < Float::NAN returns an implementation-dependent value.