Issue #5713 has been updated by John Firebaugh.


The execution path of 0 ** -Bignum goes to Rational(0) ** -Bignum, so I think the issue is there. I.e. Rational(0) ** -Bignum should raise ZeroDivisionError, the same as Rational(0) ** -Fixnum.
----------------------------------------
Bug #5713: Fixnum#** returns Infinity for 0 ** negative Bignum
http://redmine.ruby-lang.org/issues/5713

Author: John Firebaugh
Status: Open
Priority: Normal
Assignee: Marc-Andre Lafortune
Category: 
Target version: 
ruby -v: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]


=begin
Instead it should raise ZeroDivisionError, the same as negative Fixnums.

 wordsize = 8 * 1.size
 fixnum_min = -2 ** (wordsize - 2)
 
 def zero_power(exp)
   0 ** exp
 rescue ZeroDivisionError
   "ZeroDivisionError"
 end
 
 [-1, fixnum_min, (fixnum_min-1)].each {|i| puts zero_power(i)}
=end



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