From faea8893f82230eb0e2c5759361138fa20af7a9a Mon Sep 17 00:00:00 2001 From: tadf Date: Sun, 28 Jun 2009 12:20:02 +0000 Subject: * 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 --- lib/cmath.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3