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:from:date :message-id:subject:to:content-type; q=dns; s=default; b=ey2ZwV4 WI6q2geYRmbMrQ4Ek+vUfjevAPipYmAWghCzMDWLWINyTPd6bpOl0LCaZ5256F0u YivqIkUGQBeos9zsGdd0xBVU16ZRFDjH5ZL0aiiUIw7hCf1pyt2kBz2GNH8lzpsH ypKCsOF4QLepPstIwzdswtsIRvnh6Y7m2XLU= 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:from:date :message-id:subject:to:content-type; s=default; bh=fCZ4jrA6wr/fz CZIpFecNTlNOtM=; b=ENlHeOmHKuHbnq3VUwqKe12WqxH4scq9RGm0vY3QiMV7G Z6nYG3GIz5O5cY9NLYJMwynJIKlrjiFe+jYjbOYUj1d0wwKEb4wpoJrFVjHo1LXS C2wsN4qjwSKC3DsT1SJpgfH5rgb35nKRdszImJ9IgC0XdlVcoSlb4KOlxzUPvw= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.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 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 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> In-Reply-To: <8636vgac6e.fsf@gmail.com> From: Stephen John Smoogen Date: Tue, 14 Aug 2018 17:31:17 -0400 Message-ID: Subject: Re: strtod ("nan") returns negative NaN To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes 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