This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Fwd: Floating point exception in strtod()
- From: Ken Brown <kbrown at cornell dot edu>
- To: newlib at sourceware dot org
- Date: Sat, 7 Apr 2018 13:45:57 -0400
- Subject: Fwd: Floating point exception in strtod()
- References: <dd5e98ea-8f39-1c4b-116c-37968cb3a52d@cornell.edu>
I just sent this to the cygwin list, but it probably belongs here.
-------- Forwarded Message --------
Subject: Floating point exception in strtod()
Resent-From: kbrown@cornell.edu
Date: Sat, 7 Apr 2018 13:40:05 -0400
From: Ken Brown <kbrown@cornell.edu>
To: cygwin <cygwin@cygwin.com>
$ cat strtod_test.c
#include <stdio.h>
#include <stdlib.h>
#include <fenv.h>
int
main ()
{
/* The following number comes from /usr/share/asymptote/ode.asy. */
const char *str = "121645100408832000.0";
char *ptr;
feenableexcept (FE_INVALID);
strtod (str, &ptr);
/* If there was an exception, the following will not get executed. */
printf ("No exception.\n");
}
$ gcc strtod_test.c
$ ./a
Floating point exception (core dumped)
[The above was on x86. On x86_64 there's simply no output.]
I have no idea what's special about the number 121645100408832000.0, but
the problem goes away if, for example, I replace the leading 1 by 2.
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--
!<symlink>ÿþ/