Project

General

Profile

This project is closed and read-only.

Actions

Bug #769

closed

Mathn's Rational#power2 is broken on 1.8.6 and 1.8.7

Bug #769: Mathn's Rational#power2 is broken on 1.8.6 and 1.8.7

Added by jredville (Jim Deville) almost 18 years ago. Updated over 15 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
[ruby-core:20010]

Description

=begin
Mathn's Rational#power2 method is broken in multiple places.

  1. The loop has no variant, it can go into an infinite loop, unless the conditional is true from the start.
  2. 1.8.6 still has the neaed typo (Redmine #175)
  3. assignment to nearn on line 208
  4. Construction of a Rational with 2 non-existant variables: num and den (dem is used, but not den)

Some test cases that demonstrate the broken code:
(Rational.new!(1, 4).power2(Rational.new!(1, 2))) #(NameError for neaed)
(Rational.new!(3, 4).power2(Rational.new!(0, 3))) #Infinite loop
=end


Related issues 1 (0 open1 closed)

Has duplicate Ruby 1.8 - Bug #768: Mathn's Rational#power2 is broken on 1.8.6 and 1.8.7ClosedActions

Updated by jredville (Jim Deville) almost 18 years ago Actions #1

=begin
This is tested in RubySpec: 1.8/library/mathn/rational/power2_spec.rb. If you test with this, you'll need to remove the ruby_bug guards, or run with -n foo to bypass them.
=end

Updated by matz (Yukihiro Matsumoto) almost 18 years ago Actions #2

  • Status changed from Open to Closed

=begin

=end

Updated by matz (Yukihiro Matsumoto) almost 18 years ago Actions #3

=begin
Yes, power2 is broken. But it also was undocumented and planned to remove (1.9 already removed). So, in short, ignore it.

=end

Actions

Also available in: PDF Atom