Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Complex#finite?
() -> bool
finite? → true or false
complex.c
View on GitHub ↗
static VALUE
rb_complex_finite_p(VALUE self)
{
get_dat1(self);
return RBOOL(f_finite_p(dat->real) && f_finite_p(dat->imag));
}
Returns true if both self.real.finite? and self.imag.finite? are true, false otherwise:
Example
Complex.rect(1, 1).finite? # => true Complex.rect(Float::INFINITY, 0).finite? # => false
Related: Numeric#finite?, Float#finite?.