public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Christophe MONAT <christophe.monat@st.com>
To: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Cc: "newlib@sourceware.org" <newlib@sourceware.org>,
	Jeff Johnston <jjohnstn@redhat.com>
Subject: RE: compiling newlib
Date: Tue, 25 Aug 2020 07:37:07 +0000	[thread overview]
Message-ID: <PR3PR10MB3850AE3EE01A35C50B548F83E0570@PR3PR10MB3850.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <mwh7sr446m.fsf@tomate.loria.fr>

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


  reply	other threads:[~2020-08-25  7:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21  8:20 Paul Zimmermann
2020-08-24 19:41 ` Jeff Johnston
2020-08-25  6:42   ` Paul Zimmermann
2020-08-25  7:37     ` Christophe MONAT [this message]
2020-08-25  8:39       ` Paul Zimmermann
2020-08-25  8:50         ` Christophe MONAT
2020-08-25 17:04     ` Keith Packard
  -- strict thread matches above, loose matches on Subject: below --
2003-11-26 21:57 Xavier Pegenaute
2000-12-19 22:59 HenrySimmons17
2000-12-19 23:39 ` Alexandre Oliva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PR3PR10MB3850AE3EE01A35C50B548F83E0570@PR3PR10MB3850.EURPRD10.PROD.OUTLOOK.COM \
    --to=christophe.monat@st.com \
    --cc=Paul.Zimmermann@inria.fr \
    --cc=jjohnstn@redhat.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).