summaryrefslogtreecommitdiff
path: root/lib/cmath.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cmath.rb')
-rw-r--r--lib/cmath.rb3
1 files changed, 2 insertions, 1 deletions
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