1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
keiju 2007-11-26 04:33:21 +00:00
parent 2ed2078909
commit e6140f3e3c
2 changed files with 7 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Mon Nov 26 13:28:14 2007 Keiju Ishitsuka <keiju@ruby-lang.org>
* lib/complex.rb: be able to create Complex(0, -0.0). [ruby-list:44268]
Mon Nov 26 11:24:04 2007 Tanaka Akira <akr@fsij.org>
* re.c (rb_reg_fixed_encoding_p): extracted from rb_reg_prepare_re and

View file

@ -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