From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123875 invoked by alias); 14 Aug 2018 01:10:01 -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 123850 invoked by uid 89); 14 Aug 2018 01:09:59 -0000 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 Received: from msc13.plala.or.jp (HELO msc13.plala.or.jp) (60.36.166.23) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Aug 2018 01:09:58 +0000 Received: from localhost ([223.217.20.9]) by msc13.plala.or.jp with ESMTP id <20180814010955.NSIQ22638.msc13.plala.or.jp@localhost> for ; Tue, 14 Aug 2018 10:09:55 +0900 Date: Tue, 14 Aug 2018 01:10:00 -0000 Message-Id: <20180814.100952.1684125661222835312.trueroad@trueroad.jp> To: cygwin@cygwin.com Subject: Re: `std::stod ("nan")` returns negative NaN From: Masamichi Hosoda In-Reply-To: References: <20180813234603.GA2310@dimstar.local.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 X-SW-Source: 2018-08/txt/msg00160.txt.bz2 > 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