Method: Integer#fdiv
- Defined in:
- numeric.c
#fdiv(numeric) ⇒ Float
Returns the Float result of dividing self by numeric:
4.fdiv(2) # => 2.0
4.fdiv(-2) # => -2.0
-4.fdiv(2) # => -2.0
4.fdiv(2.0) # => 2.0
4.fdiv(Rational(3, 4)) # => 5.333333333333333
Raises an exception if numeric cannot be converted to a Float.
4218 4219 4220 4221 4222 4223 4224 4225 |
# File 'numeric.c', line 4218
VALUE
rb_int_fdiv(VALUE x, VALUE y)
{
if (RB_INTEGER_TYPE_P(x)) {
return DBL2NUM(rb_int_fdiv_double(x, y));
}
return Qnil;
}
|