Issue #6958 has been updated by marcandre (Marc-Andre Lafortune).

Status changed from Assigned to Rejected

Closing, as it is now covered by feature request #6973

I was also surprised by the fact that `.integer?` is equivalent to `is_a?(Integer)`. It makes that method completely redundant (and less clear than using is_a?).

Did we ever remove a method in Ruby?
----------------------------------------
Feature #6958: buggy BigDecimal#integer?
https://bugs.ruby-lang.org/issues/6958#change-29184

Author: adrianomitre (Adriano Mitre)
Status: Rejected
Priority: Normal
Assignee: mrkn (Kenta Murata)
Category: core
Target version: 


=begin
BigDecimal#integer? always return false, which is wrong in many cases, as shown below.

 x, y = BigDecimal('1'), BigDecimal('1.0')

 x.integer?
 #=> false

 y.integer?
 #=> false

 x == x.to_i
 #=> true

 y == y.to_i
 #=> true

 # Possible workaround
 #
 class BigDecimal
   def integer?
     self == self.to_i
   end
 end
=end



-- 
http://bugs.ruby-lang.org/