diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/complex.rb | 16 | ||||
-rw-r--r-- | lib/rational.rb | 9 |
2 files changed, 10 insertions, 15 deletions
diff --git a/lib/complex.rb b/lib/complex.rb index 6b3e42f4e2..53d0f5e0bb 100644 --- a/lib/complex.rb +++ b/lib/complex.rb @@ -411,19 +411,18 @@ end class Fixnum - alias power! ** - + unless defined? 1.power! + alias power! ** + p [__FILE__, defined? 1.power!] + end + # Redefined to handle a Complex argument. def ** (other) if self < 0 Complex.new!(self, 0) ** other else - if defined? Rational - if other >= 0 - self.power!(other) - else - Rational.new!(self,1)**other - end + if defined? self.rpower + self.rpower(other) else self.power!(other) end @@ -597,7 +596,6 @@ module Math end - # Documentation comments: # - source: original (researched from pickaxe) # - a couple of fixme's diff --git a/lib/rational.rb b/lib/rational.rb index e0a364246b..38af7b8a81 100644 --- a/lib/rational.rb +++ b/lib/rational.rb @@ -329,10 +329,6 @@ class Integer end class Fixnum - unless defined? Complex - alias power! **; - end - undef quo def quo(other) Rational.new!(self,1) / other @@ -346,8 +342,9 @@ class Fixnum Rational.new!(self,1)**other end end - - unless defined? Complex + + unless defined? 1.power! + alias power! ** alias ** rpower end end |