Method: Complex#denominator
- Defined in:
- complex.c
#denominator ⇒ Integer
Returns the denominator of self
, which is the least common multiple of self.real.denominator
and self.imag.denominator
:
Complex.rect(Rational(1, 2), Rational(2, 3)).denominator # => 6
Note that n.denominator
of a non-rational numeric is 1
.
Related: Complex#numerator.
1488 1489 1490 1491 1492 1493 |
# File 'complex.c', line 1488
static VALUE
nucomp_denominator(VALUE self)
{
get_dat1(self);
return rb_lcm(f_denominator(dat->real), f_denominator(dat->imag));
}
|