summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-28 12:20:02 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-28 12:20:02 +0000
commitfaea8893f82230eb0e2c5759361138fa20af7a9a (patch)
treee21b99ba4e51a51d1af748f23b37ca9e5944648c
parentf365778c263db6a3d02f3c2fcf676e8964a4674e (diff)
* lib/cmath.rb (sqrt): fixed an issue [ruby-list:45852]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--lib/cmath.rb3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 580cc49255..3af2e62431 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Jun 28 21:16:48 2009 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/cmath.rb (sqrt): fixed an issue [ruby-list:45852].
+
Sun Jun 28 19:48:29 2009 Tadayoshi Funaba <tadf@dotrb.org>
* complex.c (nucomp_expt): some improvements.
diff --git a/lib/cmath.rb b/lib/cmath.rb
index d9e53f361a..6b47e70a15 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -63,7 +63,8 @@ module CMath
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