public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Duncan Roe <duncan_roe@optusnet.com.au>
To: cygwin@cygwin.com
Subject: Re: Floating point exception in strtod()
Date: Sun, 08 Apr 2018 03:12:00 -0000	[thread overview]
Message-ID: <20180408031147.GA3305@dimstar.local.net> (raw)
In-Reply-To: <6e4ccba4-a74b-fb78-db0c-b8d1a2260658@cs.umass.edu>

On Sat, Apr 07, 2018 at 04:56:13PM -0400, Eliot Moss wrote:
> On 4/7/2018 1:40 PM, Ken Brown wrote:
> > $ 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");
> > }
>
> If I do the same thing WITHOUT the feenableexcept, it works fine.
> Perhaps strtod catches an exception and then applies a different
> method in some cases, or perhaps it wants exceptions off and
> deals with things its own way.
>
> If I include the feenableexcept, I get the same behavior you
> reported (in 32-bit; I did not test 64-bit).
>
> Regards - Eliot Moss
>
I tried in 64-bit with the same result as Eliot: works fine w/out
feenableexcept, no o/p with feenableexcept.

Cheers ... Duncan.

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

  reply	other threads:[~2018-04-08  3:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07 17:40 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 [this message]
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

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=20180408031147.GA3305@dimstar.local.net \
    --to=duncan_roe@optusnet.com.au \
    --cc=cygwin@cygwin.com \
    /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).