X-Recipient: archive-cygwin@delorie.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:from:to:subject:references:date:in-reply-to
	:message-id:mime-version:content-type; q=dns; s=default; b=icGgD
	eoG7tHRpL64U4r9eR7V2aKiFFUwa/OQVz12i5ZnfRCmjJXxxi5eMmGWasEHndx+9
	AuAyjdw4ESAOldXICw5qXQYcN1IpuswZOVkpeobiXuCAD21174AzSrBp4cAeDSfr
	eYt9NBbMlAjb1gOy5NkpDvb4w3OCRvIoB9t7xg=
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:from:to:subject:references:date:in-reply-to
	:message-id:mime-version:content-type; s=default; bh=jLpMnKbYggJ
	lQl3zyFhAwXV62x0=; b=dCvCWrtb2Sv6hWy+mvSAB9Y/nTDIN2QuHBph1WzfSTQ
	/c7fubPKquF2lkeySq8EoU/C23AEMYlMD18bBqIpZOkzCpx+jwtRwKb7nUKs7S6X
	YbKLIvi0Q9Br4crIg4g/e/EnPNfxBWLLtgdgA/1tL2WRFu0A5JuRXTKMJTcdF/FU
	=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:ESMTPA
X-HELO: vsmx012.vodafonemail.xion.oxcs.net
From: Achim Gratz <Stromeko@nexgo.de>
To: cygwin@cygwin.com
Subject: Re: strtod ("nan") returns negative NaN
References: <CANnLRdii8mX71D936AhhEYm+S0s4gS5RGgpPhV_rB6=kzmXKsw@mail.gmail.com>	<20180814.100952.1684125661222835312.trueroad@trueroad.jp>	<20180814.113135.1571893395887584078.trueroad@trueroad.jp>	<20180814.134527.917341694729989717.trueroad@trueroad.jp>	<20180814095618.GT3747@calimero.vinschen.de>	<20180814103900.GU3747@calimero.vinschen.de>
Date: Tue, 14 Aug 2018 21:24:05 +0200
In-Reply-To: <20180814103900.GU3747@calimero.vinschen.de> (Corinna Vinschen's	message of "Tue, 14 Aug 2018 12:39:00 +0200")
Message-ID: <87lg98eoq2.fsf@Rainer.invalid>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain

Corinna Vinschen writes:
> With your patch, strtold looks more correct, but it still prints the
> sign of NaN:
>
>   strtod ("nan", NULL) = nan
>   strtod ("-nan", NULL) = nan
>   strtold ("nan", NULL) = nan
>   strtold ("-nan", NULL) = -nan
>   nan ("") = nan
>
> Question: What's wrong with that?  Wouldn't it be more correct if
> strtod returns -NaN for "-nan" as well?

That's iffy, the treatment of sign bits for NaN is quite different from
the usual arithmetic rules.  A NaN is literally "not a number", i.e. the
computation has left the domain of representable FP numbers, so it
really doesn't have a sign.  That doesn't stop folks from using the sign
bit on its representation, but that's a different story.  The sign
properly belong to what is called the "payload", which is usally
ignored.  So converting "-nan" (or NaN multiplied by -1) really ought to
be just plain NaN.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

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

