Issue #175 has been reported by Arthur Schreiber.

----------------------------------------
Bug #175: Rational#power2 raises a NameError or causes infinite loops when passed a Rational
http://redmine.ruby-lang.org/issues/show/175

Author: Arthur Schreiber
Status: Open
Priority: Normal
Assigned to: 
Category: 
Target version: 


There is propably a typo in the Rational#power2 method, as there is no variable
called "neaed", but there is one called "neard".

Desktop:~ arthur$ irb
irb(main):001:0> require "mathn"
=> true
irb(main):002:0> Rational(1, 4).power2(Rational(1, 2))
NameError: undefined local variable or method `neaed' for 1/4:Rational
	from /usr/local/lib/ruby/1.8/mathn.rb:204:in `power2'
	from /usr/local/lib/ruby/1.8/mathn.rb:202:in `loop'
	from /usr/local/lib/ruby/1.8/mathn.rb:202:in `power2'
	from (irb):2

If you pass a value that is equal to self, it will cause an infinite loop:

Rational(1, 2).power2(Rational(1, 2)) # => Infinite Loop
Rational(1, 4).power2(Rational(1, 4)) # => Infinite Loop


----------------------------------------
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://redmine.ruby-lang.org/my/account