summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/mathn.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/mathn.rb b/lib/mathn.rb
index 48cb99f8c6..0241f578e9 100644
--- a/lib/mathn.rb
+++ b/lib/mathn.rb
@@ -134,6 +134,8 @@ module Math
else
Complex(x, -y)
end
+ elsif a.respond_to?(:nan?) and a.nan?
+ a
elsif a >= 0
rsqrt(a)
else