Method: Float#-

Defined in:
numeric.c

#-(other) ⇒ Numeric

Returns a new Float which is the difference of self and other:

f = 3.14
f - 1                 # => 2.14
f - 1.0               # => 2.14
f - Rational(1, 1)    # => 2.14
f - Complex(1, 0)     # => (2.14+0i)

Returns:



1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
# File 'numeric.c', line 1177

VALUE
rb_float_minus(VALUE x, VALUE y)
{
    if (FIXNUM_P(y)) {
        return DBL2NUM(RFLOAT_VALUE(x) - (double)FIX2LONG(y));
    }
    else if (RB_BIGNUM_TYPE_P(y)) {
        return DBL2NUM(RFLOAT_VALUE(x) - rb_big2dbl(y));
    }
    else if (RB_FLOAT_TYPE_P(y)) {
        return DBL2NUM(RFLOAT_VALUE(x) - RFLOAT_VALUE(y));
    }
    else {
        return rb_num_coerce_bin(x, y, '-');
    }
}