From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123078 invoked by alias); 13 Aug 2018 16:53:03 -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 123068 invoked by uid 89); 13 Aug 2018 16:53:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*jp, HX-HELO:sk:mail-pf, H*r:sk:mail-pf X-HELO: mail-pf1-f176.google.com Received: from mail-pf1-f176.google.com (HELO mail-pf1-f176.google.com) (209.85.210.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Aug 2018 16:53:01 +0000 Received: by mail-pf1-f176.google.com with SMTP id l9-v6so7915808pff.9 for ; Mon, 13 Aug 2018 09:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MPAtezmUCiZ/TsRGr2Lf4Z+Mwlr+P3nM8Je/j7LoWoo=; b=He5GgI4cHV9vvqCx9S3BZ3bAsdsQZIm5meAtXJoC1grtdtIDiQv7YKlok2umQ9A+YC bHZ2oM1kVn0gSIBpPPlORg2+HQEVdEqzi64r+3T1P4UJW7+qs1TzC7cbUdHjrqZJ5iYW DNFPEYri3o1kUm6uYVQEJRc7bbUgBZFV7v0jgfjZAswtp/rtoJSz+SYQjva/tPOpYNxr dSUyLI+510Ey0bzGyf5JxdLX+1iwXbb4AEwFwa7q5C61bBAk8djIXSnVbY/o9rerk1t5 /IkK8JU3tfOAkMNszXzSbInWzTs0/7GIC51XxGaSSQBHan+3SvHpuyrQDHNVAVcC2lSM 7ytQ== MIME-Version: 1.0 References: <20180814.001550.1040828527127506667.trueroad@trueroad.jp> In-Reply-To: <20180814.001550.1040828527127506667.trueroad@trueroad.jp> From: Stephen John Smoogen Date: Mon, 13 Aug 2018 16:53:00 -0000 Message-ID: Subject: Re: `std::stod ("nan")` returns negative NaN To: cygwin@cygwin.com Cc: trueroad@trueroad.jp Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00151.txt.bz2 On Mon, 13 Aug 2018 at 11:16, Masamichi Hosoda wrote: > > 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 > ``` > On Fedora 27 with 7.3.1 it gives ``` stod ("nan") = nan stod ("-nan") = nan quiet_NaN () = nan ``` So it looks like it is a library problem of some sort. > 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 > -- Stephen J Smoogen. -- 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