Message ID | 54889123.2030608@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On Wed, 10 Dec 2014, Adhemerval Zanella wrote: > Something like that: > > diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c > index 1961355..641cfd6 100644 > --- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c > +++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c > @@ -70,12 +70,16 @@ > > #include <math.h> > #include <math_private.h> > +#include <libc-internal.h> > > +DIAG_PUSH_NEEDS_COMMENT; > +DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow"); Well, *with the comment* explaining the warning and referring to the existing open bug for it. Never add diagnostic suppression macros without appropriate comments explaining the suppression. > I still trying to figure out why the test for MAXLGM is necessary (it > seems redundant to me, since for overflow it will be generate by the log > call itself). Anyway, I know this is not the perfect solution, but I In some rounding modes, without the MAXLGM test you'd get LDBL_MAX (finite) as the overflowed result from (x - 0.5L) * __logl (x), and then adding (negative) q (== ls2pi - x) would result in a return other than LDBL_MAX, which would not be correct for overflow.
On 12/10/2014 10:29 AM, Adhemerval Zanella wrote:
> static const long double huge = 1.0e4000L;
__builtin_huge_vall() ? That would suppress the werror for this line too...
r~
On 11-12-2014 14:28, Richard Henderson wrote: > On 12/10/2014 10:29 AM, Adhemerval Zanella wrote: >> static const long double huge = 1.0e4000L; > __builtin_huge_vall() ? That would suppress the werror for this line too... > > > r~ > I pushed a patch using LDBL_MAX as Joseph suggestion.
diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c index 1961355..641cfd6 100644 --- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c +++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c @@ -70,12 +70,16 @@ #include <math.h> #include <math_private.h> +#include <libc-internal.h> +DIAG_PUSH_NEEDS_COMMENT; +DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow"); static const long double PIL = 3.1415926535897932384626433832795028841972E0L; static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L; static const long double one = 1.0L; static const long double zero = 0.0L; static const long double huge = 1.0e4000L; +DIAG_POP_NEEDS_COMMENT; /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2) 1/x <= 0.0741 (x >= 13.495...)