summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-17 16:00:23 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-09-17 16:00:23 +0000
commit07fc7586b76bdbf965f0803fb91a2e5e66c72734 (patch)
treeaf150f8a54ac2ae03342f8de3a96545f56c1824b
parentcc24eb85189fe811f4cdd01b5ba070461d5c376a (diff)
* lib/mathn.rb (Rational::inspect): should preserve original
operand. [ruby-core:05806] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/mathn.rb5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 49d0cb3..e06b514 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Sep 17 23:25:04 2005 sheepman <sheepman@sheepman.sakura.ne.jp>
+
+ * lib/mathn.rb (Rational::inspect): should preserve original
+ operand. [ruby-core:05806]
+
Sat Sep 17 23:20:27 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/cgi.rb (CGI::Cookie): should handle multiple values for a
diff --git a/lib/mathn.rb b/lib/mathn.rb
index 2257a40..14e2e92 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