Message ID | ade57a24-aa87-e990-b2fc-0d9211c7284c@verizon.net |
---|---|
State | New |
Headers | show |
Series | [libquadmath,pr68686] tgammaq(x) is always negative for noninteger x < 0 | expand |
Ed, gfortran uses libquadmath for support of its REAL(16) intrinsic subprograms. I checked the list of intrinsics and tgamma is current not in the list. I don't have time to try Fortran's C interop feature to see if an ordinary user can access __float128. While your patch is probably useful for GCC, I doubr that gfortran in its current state will use tgammal. You'll need either Jakub or Joseph (jsm28) to give an OK.
diff --git a/libquadmath/math/tgammaq.c b/libquadmath/math/tgammaq.c index a07d583..3080094 100644 --- a/libquadmath/math/tgammaq.c +++ b/libquadmath/math/tgammaq.c @@ -47,7 +47,9 @@ tgammaq (__float128 x) /* 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; }