From 6125552c27b40a8da9e162af2655feca82ac16d3 Mon Sep 17 00:00:00 2001 From: tadf Date: Sun, 16 Mar 2008 00:23:43 +0000 Subject: both complex and rational are now builtin classes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/mathn.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/mathn.rb') diff --git a/lib/mathn.rb b/lib/mathn.rb index 724d37ea6f..f3be55eb6d 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -127,7 +127,7 @@ class Rational if other.kind_of?(Rational) other2 = other if self < 0 - return Complex.new!(self, 0) ** other + return Complex.__send__(:new!, self, 0) ** other elsif other == 0 return Rational(1,1) elsif self == 0 @@ -175,7 +175,7 @@ class Rational num = 1 den = 1 end - Rational.new!(num, den) + Rational(num, den) elsif other.kind_of?(Float) Float(self) ** other else @@ -187,7 +187,7 @@ class Rational def power2(other) if other.kind_of?(Rational) if self < 0 - return Complex(self, 0) ** other + return Complex.__send__(:new!, self, 0) ** other elsif other == 0 return Rational(1,1) elsif self == 0 @@ -219,7 +219,7 @@ class Rational num = 1 den = 1 end - Rational.new!(num, den) + Rational(num, den) elsif other.kind_of?(Float) Float(self) ** other else @@ -306,4 +306,3 @@ end class Complex Unify = true end - -- cgit v1.2.3