Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Complex#infinite?

cmp.infinite? → nil or 1

Returns 1 if cmp‘s real or imaginary part is an infinite number, otherwise returns nil.

Example
For example:

   (1+1i).infinite?                   #=> nil
   (Float::INFINITY + 1i).infinite?   #=> 1
See also #imaginary #inspect #imag #magnitude also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1