Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Complex#denominator

() -> ::Integer
denominator → integer

Returns the denominator of self, which is the least common multiple of self.real.denominator and self.imag.denominator:

Example
Complex.rect(Rational(1, 2), Rational(2, 3)).denominator # => 6

Note that n.denominator of a non-rational numeric is 1.

Related: Complex#numerator.

See also #conjugate #fdiv #conj #finite? also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0