diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-23 06:48:42 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-23 06:48:42 +0000 |
commit | 99825ae914014a70c37a68f750ac651cb250ad9a (patch) | |
tree | 2280bd1cb6b31bdcb4dec8c891eff1026a2031be /lib/mathn.rb | |
parent | 1bd7257dc8884d7cdd80e2a2b551b9016c3b9ddd (diff) |
* lib/mathn.rb: Math.sqrt(NaN) should be NaN. [ruby-dev:37537]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mathn.rb')
-rw-r--r-- | lib/mathn.rb | 2 |
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 |