Bug #175
closed
Rational#power2 raises a NameError or causes infinite loops when passed a Rational
Added by NoKarma (Arthur Schreiber) over 16 years ago.
Updated over 13 years ago.
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
=begin
Why is ruby 1.8.7 not using version 1.5.8 from
http://dev.ctor.org/soap4r? What is the process for including soap4r
changes? Is it tied to nahi?
Just curious ;-)
eTM
=end
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r17449.
=end
=begin
Rational#power2 is still not working correctly:
Rational(1, 4).power2(Rational(1, 2)) # => NameError: undefined local variable or method `num' for 1/4:Rational
Rational(1, 4).power2(Rational(1, 4)) # => Infinite Loop
Rational(1, 2).power2(Rational(1, 2)) # => Infinite Loop
=end
- Status changed from Closed to Assigned
- Assignee set to matz (Yukihiro Matsumoto)
- % Done changed from 100 to 0
=begin
Hi,
In message "Re: [ruby-core:17354] [Ruby 1.8 - Bug #175] Rational#power2 raises a NameError or causes infinite loops when passed a Rational"
on Sat, 21 Jun 2008 00:54:00 +0900, Arthur Schreiber redmine@ruby-lang.org writes:
|Rational#power2 is still not working correctly:
I'll see. But note that power2 is not a part of public API of
Rational.
matz.
=end
- Status changed from Assigned to Closed
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0