aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mathn.rb
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-16 00:23:43 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-16 00:23:43 +0000
commit6125552c27b40a8da9e162af2655feca82ac16d3 (patch)
tree8f77bc1b34603f4ce939aa4b5a77f5e8303b7df4 /lib/mathn.rb
parent2694b2f937681526550b8aabf798f033fa557049 (diff)
downloadruby-6125552c27b40a8da9e162af2655feca82ac16d3.tar.gz
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
Diffstat (limited to 'lib/mathn.rb')
-rw-r--r--lib/mathn.rb9
1 files changed, 4 insertions, 5 deletions
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
-