From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111453 invoked by alias); 13 Aug 2018 15:16:00 -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 110633 invoked by uid 89); 13 Aug 2018 15:16:00 -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, 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; Mon, 13 Aug 2018 15:15:58 +0000 Received: from localhost ([223.217.20.9]) by msc13.plala.or.jp with ESMTP id <20180813151555.NONY22638.msc13.plala.or.jp@localhost>; Tue, 14 Aug 2018 00:15:55 +0900 Date: Mon, 13 Aug 2018 15:16:00 -0000 Message-Id: <20180814.001550.1040828527127506667.trueroad@trueroad.jp> To: cygwin@cygwin.com Cc: trueroad@trueroad.jp Subject: `std::stod ("nan")` returns negative NaN From: Masamichi Hosoda Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-VirusScan: Outbound; mvir-ac13; Tue, 14 Aug 2018 00:15:55 +0900 X-SW-Source: 2018-08/txt/msg00150.txt.bz2 Hi I've found a curious behavior about `std::stod ("nan")` on Cygwin. Only on Cygwin, `std::stod ("nan")` returns negative NaN. On Linux etc., `std::stod ("nan")` returns positive NaN. Here is a reproduction code. ``` // g++ -std=c++11 foobar.cc #include #include #include int main () { std::cout << "stod (\"nan\") = " << std::stod ("nan") << std::endl; std::cout << "stod (\"-nan\") = " << std::stod ("-nan") << std::endl; std::cout << "quiet_NaN () = " << std::numeric_limits::quiet_NaN () << std::endl; } ``` The result on Cygwin 2.10.0 64 bit (g++ 7.3.0): ``` stod ("nan") = -nan stod ("-nan") = nan quiet_NaN () = nan ``` The result on MinGW-w64 64 bit (g++ 4.9.2): ``` stod ("nan") = nan stod ("-nan") = nan quiet_NaN () = nan ``` The result on Ubuntu 16.04 LTS 64 bit (g++ 5.4.0): ``` stod ("nan") = nan stod ("-nan") = nan quiet_NaN () = nan ``` The result on FreeBSD 10.1 64 bit (clang++ 3.4.1): ``` stod ("nan") = nan stod ("-nan") = nan quiet_NaN () = nan ``` Is it correct that returning negative NaN on Cygwin? Thanks. -- 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