Fix tgamma errno setting on domain error (bug 6809).
authorJoseph Myers <joseph@codesourcery.com>
Fri, 10 May 2013 11:35:11 +0000 (11:35 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 10 May 2013 11:35:11 +0000 (11:35 +0000)
ChangeLog
NEWS
math/libm-test.inc
math/w_tgamma.c
math/w_tgammaf.c
math/w_tgammal.c

index 1d83c68..fb18690 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-05-10  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #6809]
+       * math/w_tgamma.c (__tgamma): Also call __kernel_standard for
+       negative infinity argument.
+       * math/w_tgammaf.c (__tgammaf): Also call __kernel_standard_f for
+       negative infinity argument.
+       * math/w_tgammal.c (__tgammal): Also call __kernel_standard_l for
+       negative infinity argument.
+       * math/libm-test.inc (tgamma_test): Expect errno to be set for
+       domain errors.
+
 2013-05-10  Florian Weimer  <fweimer@redhat.com>
 
        * elf/sprof.c (load_profdata): Use fstat64 instead of fstat.
diff --git a/NEWS b/NEWS
index 01cef27..87d9128 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,14 +9,14 @@ Version 2.18
 
 * The following bugs are resolved with this release:
 
-  2546, 2560, 5159, 10060, 10062, 10357, 11120, 11561, 12723, 13550, 13889,
-  13951, 13988, 14142, 14176, 14200, 14280, 14293, 14317, 14327, 14478,
-  14496, 14686, 14812, 14888, 14920, 14952, 14964, 14981, 14982, 14985,
-  14994, 14996, 15003, 15006, 15007, 15020, 15023, 15036, 15054, 15055,
-  15062, 15078, 15084, 15085, 15086, 15160, 15214, 15221, 15232, 15234,
-  15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330, 15335,
-  15336, 15337, 15342, 15346, 15359, 15361, 15366, 15380, 15394, 15395,
-  15405, 15406, 15409, 15416, 15418, 15419, 15423, 15426, 15429.
+  2546, 2560, 5159, 6809, 10060, 10062, 10357, 11120, 11561, 12723, 13550,
+  13889, 13951, 13988, 14142, 14176, 14200, 14280, 14293, 14317, 14327,
+  14478, 14496, 14686, 14812, 14888, 14920, 14952, 14964, 14981, 14982,
+  14985, 14994, 14996, 15003, 15006, 15007, 15020, 15023, 15036, 15054,
+  15055, 15062, 15078, 15084, 15085, 15086, 15160, 15214, 15221, 15232,
+  15234, 15283, 15285, 15287, 15304, 15305, 15307, 15309, 15327, 15330,
+  15335, 15336, 15337, 15342, 15346, 15359, 15361, 15366, 15380, 15394,
+  15395, 15405, 15406, 15409, 15416, 15418, 15419, 15423, 15426, 15429.
 
 * CVE-2013-0242 Buffer overrun in regexp matcher has been fixed (Bugzilla
   #15078).
index c508af6..1ff59e0 100644 (file)
@@ -13615,9 +13615,9 @@ tgamma_test (void)
   TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
   TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
   /* tgamma (x) == qNaN plus invalid exception for integer x <= 0.  */
-  TEST_f_f (tgamma, -2, qnan_value, INVALID_EXCEPTION);
-  TEST_f_f (tgamma, -max_value, qnan_value, INVALID_EXCEPTION);
-  TEST_f_f (tgamma, minus_infty, qnan_value, INVALID_EXCEPTION);
+  TEST_f_f (tgamma, -2, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM);
+  TEST_f_f (tgamma, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM);
+  TEST_f_f (tgamma, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM);
   TEST_f_f (tgamma, qnan_value, qnan_value);
 
   TEST_f_f (tgamma, 0.5, M_SQRT_PIl);
index 976b5fb..6b6c7c5 100644 (file)
@@ -24,7 +24,8 @@ __tgamma(double x)
        int local_signgam;
        double y = __ieee754_gamma_r(x,&local_signgam);
 
-       if(__builtin_expect(!__finite(y), 0)&&__finite(x)
+       if(__builtin_expect(!__finite(y), 0)
+          && (__finite (x) || __isinf (x) < 0)
           && _LIB_VERSION != _IEEE_) {
          if (x == 0.0)
            return __kernel_standard(x,x,50); /* tgamma pole */
index 4814135..8bb553e 100644 (file)
@@ -22,7 +22,8 @@ __tgammaf(float x)
        int local_signgam;
        float y = __ieee754_gammaf_r(x,&local_signgam);
 
-       if(__builtin_expect(!__finitef(y), 0) && __finitef(x)
+       if(__builtin_expect(!__finitef(y), 0)
+          && (__finitef (x) || __isinff (x) < 0)
           && _LIB_VERSION != _IEEE_) {
          if (x == (float)0.0)
            /* tgammaf pole */
index 86adab2..72b247d 100644 (file)
@@ -27,7 +27,8 @@ __tgammal(long double x)
        int local_signgam;
        long double y = __ieee754_gammal_r(x,&local_signgam);
 
-       if(__builtin_expect(!__finitel(y), 0) && __finitel(x)
+       if(__builtin_expect(!__finitel(y), 0)
+          && (__finitel (x) || __isinfl (x) < 0)
           && _LIB_VERSION != _IEEE_) {
          if(x==0.0)
            return __kernel_standard_l(x,x,250); /* tgamma pole */