Re: compiling newlib

Paul Zimmermann <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.