compiling newlib
Paul Zimmermann
Paul.Zimmermann@inria.fr
Tue Aug 25 06:42:25 GMT 2020
thank you Jeff for your answer.
In return I found I believe an issue with newlib's tgammaf function, for
input -0, where it gives +inf instead of -inf:
$ cat e.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#ifdef NEWLIB
/* without this, newlib says: undefined reference to `__errno' */
int errno;
int* __errno () { return &errno; }
#endif
int
main (int argc, char *argv[])
{
float x = -0.0;
float y = tgammaf (x);
printf ("x=%.9e y=%.9e\n", x, y);
return 0;
}
With glibc :
$ gcc e.c -lm
$ ./a.out
x=-0.000000000e+00 y=-inf
With NEWLIB :
$ gcc -DNEWLIB e.c /localdisk/zimmerma/newlib/libm/libm.a
$ ./a.out
x=-0.000000000e+00 y=inf
Best regards,
Paul
More information about the Newlib
mailing list