This update introduces an error in the lgammaf_r
function inside glibc.
Test code:
#include <iostream>
#include <cmath>
int main()
{
int dsgngam;
double dresult = lgamma_r (double (-1.0), &dsgngam);
int fsgngam;
float fresult = lgammaf_r (float (-1.0), &fsgngam);
std::cout << "dresult = " << dresult << " dsgngam = " << dsgngam << '\n'
<< "fresult = " << fresult << " fsgngam = " << fsgngam << '\n' ;
}
With current gcc from the repositories:
$ g++ lgam.cc
$ ./a.out
dresult = inf dsgngam = 1
fresult = inf fsgngam = -1
With current clang from the repositories:
$ clang++ lgam.cc
$ ./a.out
dresult = inf dsgngam = 1
fresult = inf fsgngam = -1
Both dsgngam and fsgngam should be +1 for both gcc and clang but the float case gives -1 for both compilers.
The sign of the gamma function should only depend on the value of the input (-1) and not on whether it was float or double, but this version of glibc erroneously treats those datatypes differently and reports that one is positive and the other is negative.
This was working normally until the 2025-02-16 stable update, when it broke.
This discrepancy in turn results in unit test failures in downstream numerical software.