aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cmath.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cmath.rb')
-rw-r--r--lib/cmath.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cmath.rb b/lib/cmath.rb
index 00bcc9087f..9705b277b0 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -57,7 +57,7 @@ module CMath
def sqrt(z)
if z.real?
- if z >= 0
+ if z >= 0 || (Float === z && (z.nan? || z.infinite?))
sqrt!(z)
else
Complex(0, sqrt!(-z))