diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-17 16:00:23 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-17 16:00:23 +0000 |
| commit | 92bfa96a371c1ee430cdc8cf0160495911befb27 (patch) | |
| tree | af150f8a54ac2ae03342f8de3a96545f56c1824b /lib | |
| parent | b98728582c745753a3cafabe8fe52dd6f6355fbe (diff) | |
| download | ruby-92bfa96a371c1ee430cdc8cf0160495911befb27.tar.gz ruby-92bfa96a371c1ee430cdc8cf0160495911befb27.tar.xz ruby-92bfa96a371c1ee430cdc8cf0160495911befb27.zip | |
* lib/mathn.rb (Rational::inspect): should preserve original
operand. [ruby-core:05806]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mathn.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb index 2257a4074..14e2e9272 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 |
