From e824b05b3e0c01905d38af7d9c669ddc55cfcfb3 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 18 Apr 2016 17:46:05 +0000 Subject: merge revision(s) 54492,54494,54495,54496,54499,54503: [Backport #12249] * math.c (ruby_tgamma): fix tgamma(-0.0) on mingw. [ruby-core:74817] [Bug #12249] * math.c (ruby_lgamma_r): fix lgamma(-0.0) on mingw and OSX. * math.c (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong. cf. [Bug #12249] * math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows, since msvcrt does not provide it. * missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0). [ruby-core:74823] [Bug #12249] * configure.in (rb_cv_lgamma_r_m0): check if lgamma_r(-0.0) returns negative infinity. [Bug #12249] * math.c (ruby_lgamma_r): define by the configured result. * configure.in (rb_cv_lgamma_r_m0): fix the condition for lgamma_r(-0.0). [Bug #12249] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_math.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb index ab55df8e30..7091783176 100644 --- a/test/ruby/test_math.rb +++ b/test/ruby/test_math.rb @@ -255,6 +255,10 @@ class TestMath < Test::Unit::TestCase end assert_raise(Math::DomainError) { Math.gamma(-Float::INFINITY) } + x = Math.gamma(-0.0) + mesg = "Math.gamma(-0.0) should be -INF" + assert_infinity(x, mesg) + assert_predicate(x, :negative?, mesg) end def test_lgamma @@ -271,6 +275,11 @@ class TestMath < Test::Unit::TestCase assert_float_and_int([Math.log(6), 1], Math.lgamma(4)) assert_raise(Math::DomainError) { Math.lgamma(-Float::INFINITY) } + x, sign = Math.lgamma(-0.0) + mesg = "Math.lgamma(-0.0) should be [INF, -1]" + assert_infinity(x, mesg) + assert_predicate(x, :positive?, mesg) + assert_equal(-1, sign, mesg) end def test_fixnum_to_f -- cgit v1.2.3