From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85612 invoked by alias); 14 Aug 2018 21:31:41 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 85527 invoked by uid 89); 14 Aug 2018 21:31:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:h12-v6s, MAY, wherever, MUST X-HELO: mail-pg1-f182.google.com Received: from mail-pg1-f182.google.com (HELO mail-pg1-f182.google.com) (209.85.215.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Aug 2018 21:31:31 +0000 Received: by mail-pg1-f182.google.com with SMTP id h12-v6so9689567pgs.3 for ; Tue, 14 Aug 2018 14:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=4pB1I/AcP35cgzK2/VuVI7Czv8Kbfgr85BXEi8e7fyk=; b=oKv6NHGNdApb8OMQWUnbEu2nMgPra2H3xVvODf98iN6rfNJYRj0QG8alVswnmDQO3v ygqItijF+EPnux0Ck0mYMWZ4wJMvLADPq53pQElhU7Cy9B6zjzPSSugdQy1DTlwdJNaD pJffkltaCtC72uVkuZ8EuIuVKgeVYecDF55ZSufCtUEUBpAbjt2UtHnAexFv+fk6koNs uo/PP3TeffptCGVqQXF4mrR9qZrOFc4mzywlM++/oEiMuCEhHmsNwb+CU8tpfHTIGBW9 Vbj4ODpa5mYS2zzpuCFfRKnFE5cjC7WCFT5CGP0vFD7W8iSbwMApytTQf7cJvwQcrGrb 28xQ== MIME-Version: 1.0 References: <20180814132301.GX3747@calimero.vinschen.de> <5b730d82.1c69fb81.f063b.d706@mx.google.com> <8636vgac6e.fsf@gmail.com> In-Reply-To: <8636vgac6e.fsf@gmail.com> From: Stephen John Smoogen Date: Tue, 14 Aug 2018 22:23:00 -0000 Message-ID: Subject: Re: strtod ("nan") returns negative NaN To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00194.txt.bz2 On Tue, 14 Aug 2018 at 17:09, Andy Moreton wrote: > > On Tue 14 Aug 2018, Steven Penny wrote: > > a number can be positive or negative. as "NaN" is by definition not a number, > > it cannot be positive or negative, it is simply itself, something anathema to > > a number. > > 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." > Does it disagree? I would say it did if it said MUST.. but it says MAY I thought usually meant "be consistent with what you think is right for your environment but yeah whatever". And one can read the "any requirement to set the sign shall be ignored" as being -NaN should come back as NaN. I don't know how this is also affected by https://en.wikipedia.org/wiki/ISO/IEC_10967 which goes to the IEEE 754 NaN is not a number (except when it is). [ It looks from my layman point of view that Cygwin is ok with sending whatever they want back if it is implementation defined. However the bigger case is whether they want to be similar to how the other environments report things. Currently Cygwin reports -NaN for positive NaN and 'NaN' for '-NaN'.. which may be ok but doesn't match the other environments which all report NaN. [Does that make sense?] > AndyM > > > -- > 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 > -- Stephen J Smoogen. -- 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