Project

General

Profile

Actions

Feature #10641

closed

Introduce Fixnum#finite? and Bignum#finite?

Added by prijutme4ty (Ilya Vorontsov) over 9 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:67105]

Description

Hello,
I propose to introduce Fixnum#finite? and Bignum#finite? methods. Use case for this is following:

Interval = Struct.new(:from, :to) do
  def finite?
    from.finite? && to.finite?
  end
end

For now this works:

Interval.new(1.5, 1000.0).finite?
Interval.new(1.5, Float::INFINITY).finite?

But this fails due to absence of Fixnum#finite?:

Interval.new(1, 3).finite?
Interval.new(1, Float::INFINITY).finite?

It looks natural that Fixnum#finite? should always return true. I didn't worked extensively with Bignum-s, but probably Bignum#finite? should also always be true.


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #12039: Fixnum#infinite?/Bignum#infinite or Numeric#infinte, consistent with Float#infinite? and BigDecimal#infinite?Closedmrkn (Kenta Murata)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0