summaryrefslogtreecommitdiff
path: root/lib/complex.rb
diff options
context:
space:
mode:
authorkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-26 04:33:21 +0000
committerkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-11-26 04:33:21 +0000
commite6140f3e3c2a0b17ce4f254187978d2a5fea4118 (patch)
tree07659238f3fc1357988d45b72bd9bae7c7f6ce0d /lib/complex.rb
parent2ed20789094a372076ca59539d18bd2fd3062f60 (diff)
* lib/complex.rb: be able to create Complex(0, -0.0). [ruby-list:44268]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/complex.rb')
-rw-r--r--lib/complex.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/complex.rb b/lib/complex.rb
index 516bbbfd89..6b086661af 100644
--- a/lib/complex.rb
+++ b/lib/complex.rb
@@ -90,6 +90,9 @@ end
def Complex(a, b = 0)
if b == 0 and (a.kind_of?(Complex) or defined? Complex::Unify)
a
+ elsif a.scalar? and b.scalar?
+ # Don't delete for -0.0
+ Complex.new(a, b)
else
Complex.new( a.real-b.imag, a.imag+b.real )
end