[前][次][番号順一覧][スレッド一覧]

ruby-changes:2529

From: ko1@a...
Date: 26 Nov 2007 13:33:38 +0900
Subject: [ruby-changes:2529] keiju - Ruby:r14020 (trunk): * lib/complex.rb: be able to create Complex(0, -0.0).

keiju	2007-11-26 13:33:21 +0900 (Mon, 26 Nov 2007)

  New Revision: 14020

  Modified files:
    trunk/ChangeLog
    trunk/lib/complex.rb

  Log:
    * lib/complex.rb: be able to create Complex(0, -0.0). [ruby-list:44268]
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/complex.rb?r1=14020&r2=14019
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14020&r2=14019

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14019)
+++ ChangeLog	(revision 14020)
@@ -1,3 +1,7 @@
+Mon Nov 26 13:28:14 2007  Keiju Ishitsuka  <keiju@r...>
+
+	* lib/complex.rb: be able to create Complex(0, -0.0). [ruby-list:44268]
+
 Mon Nov 26 11:24:04 2007  Tanaka Akira  <akr@f...>
 
 	* re.c (rb_reg_fixed_encoding_p): extracted from rb_reg_prepare_re and
Index: lib/complex.rb
===================================================================
--- lib/complex.rb	(revision 14019)
+++ lib/complex.rb	(revision 14020)
@@ -90,6 +90,9 @@
 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]