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

ruby-changes:9110

From: tadf <ko1@a...>
Date: Fri, 12 Dec 2008 00:11:38 +0900 (JST)
Subject: [ruby-changes:9110] Ruby:r20647 (trunk): do not pass -infinity.

tadf	2008-12-12 00:11:14 +0900 (Fri, 12 Dec 2008)

  New Revision: 20647

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

  Log:
    do not pass -infinity.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20646)
+++ ChangeLog	(revision 20647)
@@ -1,7 +1,6 @@
 Thu Dec 11 23:48:00 2008  Tadayoshi Funaba  <tadf@d...>
 
-	* lib/cmath.rb (sqrt): should pass nan or infinity to the original
-	  method.
+	* lib/cmath.rb (sqrt): should pass nan to the original method.
 
 Thu Dec 11 21:04:04 2008  Kouhei Sutou  <kou@c...>
 
Index: lib/cmath.rb
===================================================================
--- lib/cmath.rb	(revision 20646)
+++ lib/cmath.rb	(revision 20647)
@@ -57,10 +57,10 @@
 
   def sqrt(z)
     if z.real?
-      if z >= 0 || (Float === z && (z.nan? || z.infinite?))
+      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/

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