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

ruby-changes:9166

From: yugui <ko1@a...>
Date: Sat, 13 Dec 2008 10:04:16 +0900 (JST)
Subject: [ruby-changes:9166] Ruby:r20703 (ruby_1_9_1): merges r20646 and r20647 from trunk into ruby_1_9_1.

yugui	2008-12-13 10:03:25 +0900 (Sat, 13 Dec 2008)

  New Revision: 20703

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20703

  Log:
    merges r20646 and r20647 from trunk into ruby_1_9_1.
    * lib/cmath.rb (sqrt): should pass nan or infinity to the original
      method.

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/lib/cmath.rb

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20702)
+++ ruby_1_9_1/ChangeLog	(revision 20703)
@@ -1,3 +1,7 @@
+Thu Dec 11 23:48:00 2008  Tadayoshi Funaba  <tadf@d...>
+
+	* lib/cmath.rb (sqrt): should pass nan to the original method.
+
 Thu Dec 11 19:31:45 2008  Tanaka Akira  <akr@f...>
 
 	* lib/test/unit/assertions.rb: extracted from lib/test/unit.rb.
Index: ruby_1_9_1/lib/cmath.rb
===================================================================
--- ruby_1_9_1/lib/cmath.rb	(revision 20702)
+++ ruby_1_9_1/lib/cmath.rb	(revision 20703)
@@ -57,10 +57,10 @@
 
   def sqrt(z)
     if z.real?
-      if z >= 0
+      if z < 0
+	Complex(0, sqrt!(-z))
+      else
 	sqrt!(z)
-      else
-	Complex(0, sqrt!(-z))
       end
     else
       if z.imag < 0

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

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