From: "nobu (Nobuyoshi Nakada)" Date: 2012-09-02T13:45:13+09:00 Subject: [ruby-core:47391] [ruby-trunk - Feature #6958][Rejected] buggy BigDecimal#integer? Issue #6958 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Rejected I was wrong. Numeric#integer? returns true if the receiver is an instance of integral class, or false. BigDecimal is not an integral object, so it must return false always, as well as Float. 1.0.integer? #=> false What you expect is not #integer? method. ---------------------------------------- Feature #6958: buggy BigDecimal#integer? https://bugs.ruby-lang.org/issues/6958#change-29134 Author: adrianomitre (Adriano Mitre) Status: Rejected Priority: High Assignee: Category: lib 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/