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

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:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=YFuDYugoAoNugCDR
POdbrIGWEWZHWkrjGk2I+xb6LUhmUvw7FPLYVioWyTid6wGOiCzEB27i9Y731soe
qFXi6V54TGOnQowKdnsfuuM1dPwjtn55JpVU+I2wk23F84I8MWAJ+JphWWZwD3Zp
z+eOO0A1VpCIR2yFK5NcG+4Tbgw=
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:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=ZXabgsHghfavDwxCr9iWYj
Ftdxk=; b=q52P3Am7J3u/JrMQALKQFvkGQxlwwA6S2UIaKWqCQPKcN/tqcT27E8
BY9ZyEnvieymHOvHCslT7/Bg+cdn4O4m8qlcw5SNhKnuxeIFAGynXZLwqQzMm7lF
bciL68f33alainyih86fQKdxqU2p0obDDJk3ZyQUvF4vGZ6HpXJHA=
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,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit
X-HELO: mailsrv.cs.umass.edu
Reply-To: moss AT cs DOT umass DOT edu
Subject: Re: Floating point exception in strtod()
To: cygwin AT cygwin DOT com
References: <dd5e98ea-8f39-1c4b-116c-37968cb3a52d AT cornell DOT edu>
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Message-ID: <6e4ccba4-a74b-fb78-db0c-b8d1a2260658@cs.umass.edu>
Date: Sat, 7 Apr 2018 16:56:13 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
MIME-Version: 1.0
In-Reply-To: <dd5e98ea-8f39-1c4b-116c-37968cb3a52d@cornell.edu>
X-IsSubscribed: yes

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

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