Project

General

Profile

Feature #10641

Updated by prijutme4ty (Ilya Vorontsov) over 6 years ago

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

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

 For now # this works: 

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

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

 ```ruby Fixnum#finite? 
 Interval.new(1, 3).finite? 
 Interval.new(1, Float::INFINITY).finite? 
 ``` 

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

Back