lgamma becomes inf for tiny negative values
VinInn opened this issue · comments
Vincenzo Innocente commented
for values that corresponds to x*x ~ 0 lgamma becomes inf for negative x.
__global__ void doit(double x) {
auto y =log(x);
auto z1= lgamma(x);
auto z2= lgamma(-x);
printf ("double %a %a %a %a\n",x,y,z1,z2);
}
produces
double 0x1p-472 -0x1.472a5c30ead69p+8 0x1.472a5c30ead69p+8 0x1.472a5c30ead69p+8
double 0x1p-522 -0x1.69d2a4df51d11p+8 0x1.69d2a4df51d11p+8 inf
in my opinion this is due to the code at line 273 (actually line 276).
(as you quote fo x<0 lgamma(x) = log(pi/(|xsin(pix)|)) - lgamma(-x); that for tiny x becomes -2log(-x) + log(-x) = -log(-x);
b-sumner commented
Thanks for the report. We'll look into it.
b-sumner commented
Thanks again for the report. This will be fixed in a future ROCm release.
b-sumner commented
This has been fixed.