diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-28 12:20:02 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-28 12:20:02 +0000 |
commit | 3f13d9f0710b22039ec405392ef83ed2f391e8ec (patch) | |
tree | e21b99ba4e51a51d1af748f23b37ca9e5944648c /lib/cmath.rb | |
parent | bf0e9a307e7795bb9b8b855a6bd7a4dc998a31c1 (diff) | |
download | ruby-3f13d9f0710b22039ec405392ef83ed2f391e8ec.tar.gz ruby-3f13d9f0710b22039ec405392ef83ed2f391e8ec.tar.xz ruby-3f13d9f0710b22039ec405392ef83ed2f391e8ec.zip |
* lib/cmath.rb (sqrt): fixed an issue [ruby-list:45852]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/cmath.rb')
-rw-r--r-- | lib/cmath.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/cmath.rb b/lib/cmath.rb index d9e53f361..6b47e70a1 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 |