delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/08/14/15:24:36

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: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 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=-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 AT nexgo DOT de>
To: cygwin AT cygwin DOT com
Subject: Re: strtod ("nan") returns negative NaN
References: <CANnLRdii8mX71D936AhhEYm+S0s4gS5RGgpPhV_rB6=kzmXKsw AT mail DOT gmail DOT com> <20180814 DOT 100952 DOT 1684125661222835312 DOT trueroad AT trueroad DOT jp> <20180814 DOT 113135 DOT 1571893395887584078 DOT trueroad AT trueroad DOT jp> <20180814 DOT 134527 DOT 917341694729989717 DOT trueroad AT trueroad DOT jp> <20180814095618 DOT GT3747 AT calimero DOT vinschen DOT de> <20180814103900 DOT GU3747 AT calimero DOT vinschen DOT 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

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019