delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/08/20/13:24:58

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=ZjgVgYVpZsCYYKzR
WtyhVLRxZIF/nb1zNE8fIqD3v0ZpyyGBRI0QHesF9FnpH67Piy+8FYzDEY6fDXYU
kpfR8JQiTX5HMHjCoH+Kozr/pXdqtXaF+zB75GNoNZ+ryzHigxXIkLmLg5AhHvC+
/5k6hoBBz9etL9RrRSXsFQFt1SI=
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=gLEXrV6qNfLr/nrmPGKpO9
K7Wh4=; b=qnLeaIZGUVMkk4deOnb/hDuA9sl2TRw2gkSIwnhgZl1Y72TH1SJp8/
Bi3f1E41thRK2FvfwWApKU5xbwS1MnUnV/9u//ySLoSfuoe6RPHudSpxbnCa5ETP
5bi30ytywDgH3m+hb59Efxw6oUcIObyTY8wMB7DBZl9t2WeSjlwY4=
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-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Brian, brian, Standard, Stephen
X-HELO: smtp-out-so.shaw.ca
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: strtod ("nan") returns negative NaN
To: cygwin AT cygwin DOT com
References: <20180814132301 DOT GX3747 AT calimero DOT vinschen DOT de> <5b730d82 DOT 1c69fb81 DOT f063b DOT d706 AT mx DOT google DOT com> <8636vgac6e DOT fsf AT gmail DOT com> <CANnLRdiv6KsEz3bQz54aL5Oxfytv=GUXxL3=MZ+4YZ75O7tTHQ AT mail DOT gmail DOT com> <06e75f75-6a5f-2140-7557-849290225f79 AT redhat DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Openpgp: preference=signencrypt
Message-ID: <2b30e006-1679-791d-bb0e-9d7949fe005d@SystematicSw.ab.ca>
Date: Mon, 20 Aug 2018 11:24:41 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <06e75f75-6a5f-2140-7557-849290225f79@redhat.com>
X-IsSubscribed: yes

On 2018-08-14 15:44, Eric Blake wrote:
> On 08/14/2018 04:31 PM, Stephen John Smoogen wrote:
>>> The C standard disagrees with you [ISO:IEC 9899:2011, section 5.2.4.2.2]:
>>> "An implementation may give zero and values that are not floating-point
>>> numbers (such as infinities and NaNs) a sign or may leave them unsigned.
>>> Wherever such values are unsigned, any requirement in this International
>>> Standard to retrieve the sign shall produce an unspecified sign, and any
>>> requirement to set the sign shall be ignored."
> Cygwin is indeed buggy for turning "NaN" into -NaN; that's easy enough to fix.
> The remaining question is whether it should turn "-NaN" into -NaN; and the
> argument that glibc JUST fixed their bug 23007 to make strtod("-nan") return
> -NaN means that Cygwin should, indeed, preserve the negative sign bit when
> parsing "-nan".
> https://sourceware.org/bugzilla/show_bug.cgi?id=23007
> So, the desired behavior:
> strtod("nan") -> NaN
> strtod("-nan") -> -NaN
> printf("%f", NaN) -> "NaN"
> printf("%f", -NaN) -> "-NaN"
> and similarly for float and long double

and wcstod, wcstod, wcstold functions.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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