This project is closed and read-only.
Actions
Bug #175
closedRational#power2 raises a NameError or causes infinite loops when passed a Rational
Bug #175:
Rational#power2 raises a NameError or causes infinite loops when passed a Rational
Description
=begin
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
=end
Actions