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

ruby-changes:12198

From: tadf <ko1@a...>
Date: Sun, 28 Jun 2009 21:20:19 +0900 (JST)
Subject: [ruby-changes:12198] Ruby:r23882 (trunk): * lib/cmath.rb (sqrt): fixed an issue

tadf	2009-06-28 21:20:02 +0900 (Sun, 28 Jun 2009)

  New Revision: 23882

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

  Log:
    * lib/cmath.rb (sqrt): fixed an issue [ruby-list:45852]

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23881)
+++ ChangeLog	(revision 23882)
@@ -1,3 +1,7 @@
+Sun Jun 28 21:16:48 2009  Tadayoshi Funaba  <tadf@d...>
+
+	* lib/cmath.rb (sqrt): fixed an issue [ruby-list:45852].
+
 Sun Jun 28 19:48:29 2009  Tadayoshi Funaba  <tadf@d...>
 
 	* complex.c (nucomp_expt): some improvements.
Index: lib/cmath.rb
===================================================================
--- lib/cmath.rb	(revision 23881)
+++ lib/cmath.rb	(revision 23882)
@@ -63,7 +63,8 @@
 	sqrt!(z)
       end
     else
-      if z.imag < 0
+      if z.imag < 0 ||
+	  (z.imag == 0 && z.imag.to_s[0] == '-')
 	sqrt(z.conjugate).conjugate
       else
 	r = z.abs

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

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