summaryrefslogtreecommitdiff
path: root/lib/mathn.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mathn.rb')
-rw-r--r--lib/mathn.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb
index 2257a4074a..14e2e9272c 100644
--- a/lib/mathn.rb
+++ b/lib/mathn.rb
@@ -124,6 +124,7 @@ class Rational
def ** (other)
if other.kind_of?(Rational)
+ other2 = other
if self < 0
return Complex.new!(self, 0) ** other
elsif other == 0
@@ -144,7 +145,7 @@ class Rational
for elm in npd
elm[1] = elm[1] * other
if !elm[1].kind_of?(Integer) and elm[1].denominator != 1
- return Float(self) ** other
+ return Float(self) ** other2
end
elm[1] = elm[1].to_i
end
@@ -152,7 +153,7 @@ class Rational
for elm in dpd
elm[1] = elm[1] * other
if !elm[1].kind_of?(Integer) and elm[1].denominator != 1
- return Float(self) ** other
+ return Float(self) ** other2
end
elm[1] = elm[1].to_i
end