public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Floating point exception in strtod()
@ 2018-04-07 17:40 Ken Brown
  2018-04-07 20:52 ` Dan Kegel
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Ken Brown @ 2018-04-07 17:40 UTC (permalink / raw)
  To: cygwin

$ 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-04-09 15:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-07 17:40 Floating point exception in strtod() Ken Brown
2018-04-07 20:52 ` Dan Kegel
2018-04-08 12:57   ` Soegtrop, Michael
2018-04-07 20:56 ` Eliot Moss
2018-04-08  3:12   ` Duncan Roe
2018-04-08 10:25     ` Hans-Bernhard Bröker
2018-04-09  9:47 ` Corinna Vinschen
2018-04-09 12:09   ` Ken Brown
2018-04-09 12:51     ` Corinna Vinschen
2018-04-09 14:46   ` Soegtrop, Michael
2018-04-09 15:33     ` Corinna Vinschen
2018-04-09 15:55       ` Soegtrop, Michael

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).