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:date:message-id:to:subject:from:in-reply-to :references:mime-version:content-type:content-transfer-encoding; q=dns; s=default; b=TNbTrd+HBjoxBHXp4MCTlSlWp8vtMgDD6WAmJDESvda xD9mSlT1Zc/mVC+C9vWzZDW4jAs+7f59krtL1r5JQmD6xE+i42ehy7ht8K/PJz7g vyRMbiTxdn27E8IhQKldZWbQrEqh36/b7r+EZVqjCl0hwxX2aj62Yh+BfsPsWs9Q = 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:date:message-id:to:subject:from:in-reply-to :references:mime-version:content-type:content-transfer-encoding; s=default; bh=KFG+P8oYf5u5MBiAMTFNHId0zcM=; b=gSXTmpG9wfaO3Yz5H ZFy3RK7JwbVXglmb5FJa6jKrs6/RXisV7zHxdNeLtsgiQRQGjVV/PapJYQiceV7p p2ZYgXNw0vmDlJjEdOCrXrGNFaKCCm6MIDCVzCGpBozuktofHhOJ7CiSZQHdD7l+ KtJZu947Uzz3sqgpgPHJ3oD8+o= 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=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*x:version, H*UA:version, Hx-languages-length:1261, H*Ad:D*jp X-HELO: msc13.plala.or.jp Date: Tue, 14 Aug 2018 10:09:52 +0900 (JST) Message-Id: <20180814.100952.1684125661222835312.trueroad@trueroad.jp> To: cygwin AT cygwin DOT com Subject: Re: `std::stod ("nan")` returns negative NaN From: Masamichi Hosoda In-Reply-To: References: <20180813234603 DOT GA2310 AT dimstar DOT local DOT net> <20180813234603_dot_GA2310_at_dimstar_dot_local_dot_net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-VirusScan: Outbound; mvir-ac13; Tue, 14 Aug 2018 10:09:55 +0900 > On Mon, 13 Aug 2018 at 19:46, Duncan Roe wrote: >> >> On Mon, Aug 13, 2018 at 12:52:48PM -0400, Stephen John Smoogen wrote: >> > On Mon, 13 Aug 2018 at 11:16, Masamichi Hosoda wrote: >> [...] >> > On Fedora 27 with 7.3.1 it gives >> > ``` >> > stod ("nan") = nan >> > stod ("-nan") = nan >> > quiet_NaN () = nan >> > ``` >> [...] > > I tested a compile on Windows Subsystem for Linux Ubuntu 18.04 which > had gcc 7.3.0. The output was the same as everything but Cygwin. At > this point it is time to pull through the gdb debugger and try to > figure out where it is coming from. I suspect `cygwin1.dll`'s `strtod ()` etc. Here's a code. ``` /* gcc foobar.c */ #include #include #include int main (void) { printf ("strtod (\"nan\", NULL) = %f\n", strtod ("nan", NULL)); printf ("strtod (\"-nan\", NULL) = %f\n", strtod ("-nan", NULL)); printf ("nan (\"\") = %f\n", nan ("")); return 0; } ``` Cygwin 2.10.0 64 bit with gcc 7.3.0 ``` strtod ("nan", NULL) = -nan strtod ("-nan", NULL) = nan nan ("") = nan ``` Ubuntu 16.04 LTS 64 bit with gcc 5.4.0 ``` strtod ("nan", NULL) = nan strtod ("-nan", NULL) = nan nan ("") = nan ``` -- 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