delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/04/07/13:40:22

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:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=G7t
UhArnIFXGbnLifHvx714tuqZOO2bPtsCGY9TZFnVHpNii/CTO0SHvt4J9+2Qx+2/
XdF4IVBFxmOTLxjm9KcOJAt+WKgPGOyWsKDSfwvhzc1wehUnEXHRBNrdjselk1tK
E2OIW/iD0Z71WqnPcif+8eJ7QxcHH4NmdmvPEk+M=
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:to:from:subject:message-id:date:mime-version
:content-type:content-transfer-encoding; s=default; bh=d3TqJTL3F
YYHeSg3d8WW5cCoaUk=; b=hVCulyd7I1WbdrWUNnVWzMgW7Fl7dojmUkUa9hyim
ObZkVATpumimkrEiqAXLOHU6sp5P25+qqFyrv7YU4gYMlNEx/vBZcyqPM8rbtKbL
r20tmrv8N0+jXdKYJux/cpa4xmDoc6JTVkRImbaZ6n3tGnnIEjzg1O4BsOj+qS5I
rk=
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=-3.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*MI:edu, H*Ad:D*edu, H*r:may, H*r:forged
X-HELO: limerock02.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
To: cygwin <cygwin AT cygwin DOT com>
From: Ken Brown <kbrown AT cornell DOT edu>
Subject: Floating point exception in strtod()
Message-ID: <dd5e98ea-8f39-1c4b-116c-37968cb3a52d@cornell.edu>
Date: Sat, 7 Apr 2018 13:40:05 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
MIME-Version: 1.0
X-PMX-Cornell-Gauge: Gauge=XXXXX
X-PMX-CORNELL-AUTH-RESULTS: dkim-out=none;
X-IsSubscribed: yes

$ 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

- Raw text -


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