Project

General

Profile

Feature #10641

Introduce Fixnum#finite? and Bignum#finite?

Added by prijutme4ty (Ilya Vorontsov) over 2 years ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
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

Related to Ruby trunk - Feature #12039: Fixnum#infinite?/Bignum#infinite or Numeric#infinte, consistent with Float#infinite? and BigDecimal#infinite?Closed

History

#1 [ruby-core:72597] Updated by prijutme4ty (Ilya Vorontsov) over 1 year ago

  • Subject changed from Introduce Fixnum#finite? to Introduce Fixnum#finite? and Bignum#finite?
  • Description updated (diff)
  • Assignee set to ruby-core

#2 Updated by naruse (Yui NARUSE) over 1 year ago

  • Assignee deleted (ruby-core)

#3 [ruby-core:78847] Updated by prijutme4ty (Ilya Vorontsov) 8 months ago

It looks, feature request can be closed (implemented in #12039)

#4 Updated by shyouhei (Shyouhei Urabe) 8 months ago

  • Related to Feature #12039: Fixnum#infinite?/Bignum#infinite or Numeric#infinte, consistent with Float#infinite? and BigDecimal#infinite? added

#5 [ruby-core:78848] Updated by shyouhei (Shyouhei Urabe) 8 months ago

Yes it is. Closing.

#6 [ruby-core:78853] Updated by duerst (Martin Dürst) 8 months ago

  • Status changed from Open to Closed

Shyouhei Urabe wrote:

Yes it is. Closing.

Second try.

Also available in: Atom PDF