summaryrefslogtreecommitdiffstats
path: root/lib/mathn.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-25 09:53:31 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-25 09:53:31 +0000
commit3e567a2e27e447b5a09291fde136964fc76807d3 (patch)
tree5fedd30b8e8f7e9267ec77381657c9be7adc19d4 /lib/mathn.rb
parent809584595d3ba4c85b93536fcae140d696ab4238 (diff)
downloadruby-3e567a2e27e447b5a09291fde136964fc76807d3.tar.gz
ruby-3e567a2e27e447b5a09291fde136964fc76807d3.tar.xz
ruby-3e567a2e27e447b5a09291fde136964fc76807d3.zip
merges r20938 from trunk into ruby_1_9_1.
* lib/mathn.rb: Math.sqrt(NaN) should be NaN. [ruby-dev:37537] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mathn.rb')
-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