mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
14fe04bdac
commit
c67251edb4
23 changed files with 244 additions and 83 deletions
|
|
@ -125,12 +125,12 @@ class Complex < Numeric
|
|||
|
||||
def / (other)
|
||||
if other.kind_of?(Complex)
|
||||
self * other.conjugate / other.abs2
|
||||
self*other.conjugate/other.abs2
|
||||
elsif Complex.generic?(other)
|
||||
Complex(@real / other, @image / other)
|
||||
Complex(@real/other, @image/other)
|
||||
else
|
||||
x , y = other.coerce(self)
|
||||
x / y
|
||||
x, y = other.coerce(self)
|
||||
x/y
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -171,8 +171,8 @@ class Complex < Numeric
|
|||
r, theta = polar
|
||||
Complex.polar(r.power!(other), theta * other)
|
||||
else
|
||||
x , y = other.coerce(self)
|
||||
x / y
|
||||
x, y = other.coerce(self)
|
||||
x/y
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue