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:cc:subject:from :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=xSq2zArmlounvJ3KMmjAYf0ZW2Hc5iHgQwH25xRDOatgktwXQ1KPK U/myyeBguVpzRph2ZhD9LJMxYMiWzCynMAjl0vilngxHoUR/jbO8xK05vNOJqmKW SgUIns5EMzE7AIUxXznnX+gPhsXl/yba0bDvaJi5EyFSMCjvnYxnc0= 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:cc:subject:from :mime-version:content-type:content-transfer-encoding; s=default; bh=1I6yhXS3i97ENJkGLpECog/jwMU=; b=vAlrgGVt54wo3FD/zaRNDaeZKsst HPrhafvMMgSbx4/+4AExn04xVDkqry8JR9xfut/me3xXWdRbW6UcQO8RsthZBbxB qTYdorCsq58Opk+UZWAr70MsTzk4HVRtqE9vc3+r7aWFfYhmTJFOe4hWTrkwH+7A a/RPMex2vWnlN/E= 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, H*Ad:D*jp X-HELO: msc13.plala.or.jp Date: Tue, 14 Aug 2018 00:15:50 +0900 (JST) Message-Id: <20180814.001550.1040828527127506667.trueroad@trueroad.jp> To: cygwin AT cygwin DOT com Cc: trueroad AT trueroad DOT 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 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