Bug #3648

Bignum Incomparable with Float::INFINITY

Added by Run Paint Run Run over 3 years ago. Updated 3 months ago.

[ruby-core:31603]
Status:Assigned
Priority:Normal
Assignee:-
Category:core
Target version:current: 2.2.0
ruby -v:ruby 1.9.3dev (2010-07-12 trunk 28620) [i686-linux] Backport:

Description

=begin

27 > Float::INFINITY
=> false
2
79 > Float::INFINITY
=> -1
279 < Float::INFINITY
=> -1
big = 2
77889
big.is_a? Bignum
=> true
big == Float::INFINITY
=> true
=end

History

#1 Updated by Nobuyoshi Nakada over 3 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28844.
Run Paint, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

#2 Updated by Yusuke Endoh over 3 years ago

  • Status changed from Closed to Open
  • Target version set to 2.0.0

=begin
Hi,

r28844 caused the following rubyspec errors.

1)
Bignum#quo does not raise a FloatDomainError when the given argument is 0 and a Float FAILED
Expected "9223372036854775811/0"
to equal "Infinity"

/home/mame/work/ruby/spec/rubyspec/core/bignum/quo_spec.rb:31:in block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/bignum/quo_spec.rb:3:in
'

2)
Complex#/ with Float returns Complex(Infinity, Infinity) when given zero ERROR
NoMethodError: undefined method infinite?' for (20/0):Rational
/home/mame/work/ruby/spec/rubyspec/shared/complex/divide.rb:41:in
block (2 levels) in '
/home/mame/work/ruby/spec/rubyspec/core/complex/divide_spec.rb:17:in block in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/complex/divide_spec.rb:1:in
'

4)
Fixnum#quo does not raise a FloatDomainError when the given Integer is 0 and a Float FAILED
Expected "0/0"
to equal "NaN"

/home/mame/work/ruby/spec/rubyspec/core/fixnum/quo_spec.rb:29:in block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/fixnum/quo_spec.rb:3:in
'

5)
Rational#/ when passed a Float returns infinity when passed 0 ERROR
NoMethodError: undefined method infinite?' for (3/0):Rational
/home/mame/work/ruby/spec/rubyspec/shared/rational/divide.rb:42:in
block (2 levels) in '
/home/mame/work/ruby/spec/rubyspec/core/rational/divide_spec.rb:16:in block in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/core/rational/divide_spec.rb:1:in
'

--
Yusuke Endoh mame@tsg.ne.jp
=end

#3 Updated by Nobuyoshi Nakada over 3 years ago

  • Status changed from Open to Closed

=begin
fixed at r28886 and r28887.
=end

#4 Updated by Yui NARUSE 7 months ago

  • Description updated (diff)
  • Status changed from Closed to Assigned
  • Target version changed from 2.0.0 to 2.1.0

r42954 reverted the commit

#5 Updated by Hiroshi SHIBATA 3 months ago

  • Target version changed from 2.1.0 to current: 2.2.0

Also available in: Atom PDF