compiling newlib
Christophe MONAT
christophe.monat@st.com
Tue Aug 25 07:37:07 GMT 2020
Paul,
+ #include <errno.h>
probably would have avoided the trouble to add newlib-specific code.
It looks also that errno differs between glibc and newlib.
>From my memory glibc has a quite thorough libm test suite checking among other things the edge cases, I don't know what exist in this domain for newlib.
Regards,
--C
-----Original Message-----
From: Newlib <newlib-bounces@sourceware.org> On Behalf Of Paul Zimmermann
Sent: Tuesday, August 25, 2020 8:42 AM
To: Jeff Johnston <jjohnstn@redhat.com>
Cc: newlib@sourceware.org
Subject: Re: compiling newlib
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