issue in cacoshf?
Paul Zimmermann
Paul.Zimmermann@inria.fr
Wed Sep 11 10:28:04 GMT 2024
Hi,
with the following program:
#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
#define CAT1(X,Y) X ## Y
#define CAT2(X,Y) CAT1(X,Y)
#define CTYPE float complex
#define FOO1 CAT2(c,FOO)
#define FOO2 CAT2(FOO1,f)
float Xbest = -0.0f, Ybest = -0.0f;
int main (int argc, char *argv[])
{
CTYPE y_re, y_im, z;
printf ("Xbest=%a Ybest=%a\n", Xbest, Ybest);
CTYPE z_in = (CTYPE) Xbest + I * (CTYPE) Ybest;
z = FOO2 (z_in);
printf ("libm gives (");
printf ("%a", creal (z));
printf (",");
printf ("%a", cimag (z));
printf (")\n");
return 0;
}
I get with the GNU libc:
$ gcc -DFOO=acosh check_cacosh2.c -lm
$ ./a.out
Xbest=-0x0p+0 Ybest=-0x0p+0
libm gives (0x0p+0,0x1.921fb6p+0)
thus we get (0,pi/2), whereas GNU MPC returns (0,-pi/2) instead.
Can someone confirm this is a bug?
Paul
PS: sorry for the cumbersome program, but with a simpler one I cannot
reproduce the issue, even with -fno-builtin.
PS2: there is the same issue with cacosh in double precision.
More information about the Libc-alpha
mailing list