Method: Float#numerator
- Defined in:
- rational.c
#numerator ⇒ Integer
Returns the numerator. The result is machine dependent.
n = 0.3.numerator #=> 5404319552844595
d = 0.3.denominator #=> 18014398509481984
n.fdiv(d) #=> 0.3
1905 1906 1907 1908 1909 1910 1911 1912 |
# File 'rational.c', line 1905
static VALUE
float_numerator(VALUE self)
{
double d = RFLOAT_VALUE(self);
if (isinf(d) || isnan(d))
return self;
return rb_call_super(0, 0);
}
|