diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-02 07:50:16 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-02 07:50:16 +0000 |
| commit | 656d0f56e2c7ee5b6c336a9664343cad6fc5b596 (patch) | |
| tree | 54b5b9d1f6957a604e8304bffbbeba8fcd0c9279 /test/ruby | |
| parent | fab8500ebf5a0d627795be441c0d3f1b9222f605 (diff) | |
| download | ruby-656d0f56e2c7ee5b6c336a9664343cad6fc5b596.tar.gz ruby-656d0f56e2c7ee5b6c336a9664343cad6fc5b596.tar.xz ruby-656d0f56e2c7ee5b6c336a9664343cad6fc5b596.zip | |
* math.c (math_gamma): get rid of direct comparison between too
big double and integer, with gcc on x86_64. [ruby-core:25257]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_math.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb index d4dbf9dbf..c62466d33 100644 --- a/test/ruby/test_math.rb +++ b/test/ruby/test_math.rb @@ -1,6 +1,10 @@ require 'test/unit' class TestMath < Test::Unit::TestCase + def assert_infinity(a, *rest) + assert(!a.finite?, *rest) + end + def check(a, b) err = [Float::EPSILON * 4, [a.abs, b.abs].max * Float::EPSILON * 256].max assert_in_delta(a, b, err) @@ -189,6 +193,13 @@ class TestMath < Test::Unit::TestCase check(2, Math.gamma(3)) check(15 * sqrt_pi / 8, Math.gamma(3.5)) check(6, Math.gamma(4)) + + # no SEGV [ruby-core:25257] + 31.upto(65) do |i| + i = 1 << i + assert_infinity(Math.gamma(i)) + assert_infinity(Math.gamma(i-1)) + end end def test_lgamma |
