diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-20 22:49:56 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-20 22:49:56 +0000 |
commit | 9467d7a02430cbe76368148fe8097d7d029e6def (patch) | |
tree | 809bc0df44376cf7d9143b6ad480f45ec5b2f250 /lib/mathn.rb | |
parent | 67526f30909c255d164d5c14d944eeda77d8d92a (diff) | |
download | ruby-9467d7a02430cbe76368148fe8097d7d029e6def.tar.gz |
* complex.c: an instance method image has been removed and
uses "imag" instead of "image".
* complex.c: two instance method re and im are removed.
* rational.c: follows the above changes.
* include/ruby/ruby.h: ditto.
* gc.c: ditto.
* lib/cmath.rb: ditto.
* lib/mathn.rb: ditto.
* lib/complex.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mathn.rb')
-rw-r--r-- | lib/mathn.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb index b29f994ac9..e918608b0d 100644 --- a/lib/mathn.rb +++ b/lib/mathn.rb @@ -37,7 +37,7 @@ class Rational if other.kind_of?(Rational) other2 = other if self < 0 - return Complex.__send__(:new!, self, 0) ** other + return Complex(self, 0.0) ** other elsif other == 0 return Rational(1,1) elsif self == 0 @@ -99,7 +99,7 @@ module Math remove_method(:sqrt) def sqrt(a) if a.kind_of?(Complex) - abs = sqrt(a.real*a.real + a.image*a.image) + abs = sqrt(a.real*a.real + a.imag*a.imag) # if not abs.kind_of?(Rational) # return a**Rational(1,2) # end @@ -108,7 +108,7 @@ module Math # if !(x.kind_of?(Rational) and y.kind_of?(Rational)) # return a**Rational(1,2) # end - if a.image >= 0 + if a.imag >= 0 Complex(x, y) else Complex(x, -y) |