mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@24738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
274fa77e3f
commit
3fe5402dfa
3 changed files with 22 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue