summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-23 06:48:42 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-23 06:48:42 +0000
commit916d811c9c3c471b6753baf8d6c0a6e42ae10f6f (patch)
tree2280bd1cb6b31bdcb4dec8c891eff1026a2031be /lib
parente271875db5b297269469dc4e81923709674c5fe5 (diff)
downloadruby-916d811c9c3c471b6753baf8d6c0a6e42ae10f6f.tar.gz
ruby-916d811c9c3c471b6753baf8d6c0a6e42ae10f6f.tar.xz
ruby-916d811c9c3c471b6753baf8d6c0a6e42ae10f6f.zip
* lib/mathn.rb: Math.sqrt(NaN) should be NaN. [ruby-dev:37537]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 48cb99f8c..0241f578e 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