delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/04/07/16:52:26

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:references:in-reply-to:reply-to
:from:date:message-id:subject:to:content-type; q=dns; s=default; b=
QB87P/MUzWKX6W1riZjLTVmhdlKJveqAO+Zn2sPIvnFnprrgeYGZmvgYNq0C9aiu
7bRqlK0cj7bZxnGcOzjYkSzXWBwvatMcYITHTlg1LxYaZY87FyVLXP4yLfO8Rub9
F+vHRGKhiGem6fgxk8mqsRWeuVXc9BZTNi+5YKSRn7w=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:references:in-reply-to:reply-to
:from:date:message-id:subject:to:content-type; s=default; bh=lak
3j47bykzhHpjTTEr+X1LhZUc=; b=EtQld8vSTM6AOXnVg1GmMapk1cLsqtfDvpz
tMNGQFeWPdCuNBDz2FAf8VafT0+GzYH35DPejKs+zHFhu60D1vB+qD6Wrgzp51Ol
ni03AeeFFzzJzfXgb97DDM2ieZRR38bFePrsfxv89CEFcJP61G4FGqx0YZe0JeRA
2XTBhqk8=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:10.98.245.7, H*c:alternative, HX-HELO:sk:mail-pf
X-HELO: mail-pf0-f172.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to; bh=6ZYMki1YSKFJX+OMYC0HpQvwZceVYp1pnx8w3VP4KJo=; b=rNmAkFO5Uo7uzzOuR/k0YUzT1/Hm0CAlHhdjqI3Jp4HIsg1DpfSn+8tlA2gfk6R37D oECefTHkqMnCBpavtXk+kdTJf+BrrI5MlTkK/yEd+QxnT7wmiUssM1GdCMFIXT4JEIMG 3ytSKSbHhi5ns6iSls3ppqVG8qzHNo4V2giCTjqjKMuxA9hlsaD5TfpYMxSB+ahbv9NP 7Ossa8hZOZf+vOV5l3SVQ60vofoOMd9Xfkkj7Opn1/xzLHdn6B/+emT2GwK567ULMrio ZhqUluDM6dxF9Irf3rSlCm0nf6W5YwJuJZojitZQ0y5Vf/FooxiQ9o6lhlQL2THsvSMT dbHg==
X-Gm-Message-State: AElRT7Fl1Arh2BJ14HnB0ZBSY9yi/muKjhEbRBCo+IdazyMrZuVtXt07 sB5fjLYGHsg6KWCXmFq3HVT0s5Laxnt8dmjuhXo=
X-Google-Smtp-Source: AIpwx4/vP0eICx24A7bo1RLkv0Uv8wawieEFCWBPjJfY1JQGjSf3Bp83LDBPyWXUrol/qaKbL2VLZy833DgPYJ1Hx0g=
X-Received: by 10.98.245.7 with SMTP id n7mr24189536pfh.164.1523134332612; Sat, 07 Apr 2018 13:52:12 -0700 (PDT)
MIME-Version: 1.0
References: <dd5e98ea-8f39-1c4b-116c-37968cb3a52d AT cornell DOT edu>
In-Reply-To: <dd5e98ea-8f39-1c4b-116c-37968cb3a52d@cornell.edu>
Reply-To: dank AT kegel DOT com
From: Dan Kegel <dank AT kegel DOT com>
Date: Sat, 07 Apr 2018 20:52:01 +0000
Message-ID: <CAPF-yOboiR8Dg+QtrHCCR55vPGysMxQ=Wbpa4QGaJ=i5PoqtkQ@mail.gmail.com>
Subject: Re: Floating point exception in strtod()
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Is that 19! ?  Probably doesn't fit precisely into a double.  Does strtold
behave better?

Some implementations throw on unrepresentable numbers, e.g.
https://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrte/index.html

Ken Brown <kbrown AT cornell DOT edu> schrieb am Sa., 7. Apr. 2018, 10:40:

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

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019