On Tue, Oct 23, 2018 at 09:45:13PM -0400, Ed Smith-Rowland wrote: > Greetings, > > This is an almost trivial patch to get the correct sign for tgammaq.
Doesn't look trivial to me. What happens if x is a NaN? Or if x is outside of the range of int? Generally, libquadmath follows what glibc does, I don't see such a change in there. So, the right fix is probably port all the upstream glibc *gamma* changes, in PR65757 as the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65757#c18 comment and my patch submission says, I've left those out because they were too large and I didn't have spare cycles for that. > --- libquadmath/math/tgammaq.c (revision 265345) > +++ libquadmath/math/tgammaq.c (working copy) > @@ -47,7 +47,9 @@ > /* x == -Inf. According to ISO this is NaN. */ > return x - x; > > - /* XXX FIXME. */ > res = expq (lgammaq (x)); > - return signbitq (x) ? -res : res; > + if (x > 0.0Q || ((int)(-x) & 1) == 1) > + return res; > + else > + return -res; > } Jakub