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:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-type; q=dns; s=default; b=Vv+N yWXus7+XTLd1M044pB9x7NQLVOpMJA1B6ZQZpYuG8nZxRdJdLpq1MOq7MLsV92N4 +BBnF1ETBo8tC+v5hjgtAOWFk05+95/NSDW/TJVS0/lYLU/msmvj2C21rxpcFU1M znCvHac3AUqaTxVAI+O3/YC9uxoBWsIxyMsvk+I= 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:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-type; s=default; bh=ZYUuTqgVtm OhQPMBGkG536GOafg=; b=KUjR0Cqi0H7Hf/r+VJGEdLwOroJfaQUpwJn3EG7FCS bKSNk5cWPZm5O4vN4wZoJyVRsevGV1pzauaxEmZ98f+qa69dgwRI+CVtyVtB4yst TvXS0MlVfC5uIm/KaHmR0wOcHxUxTb66+ZEKdyi41e/53fDfK/fzXaAafGl6RG0h w= 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=-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 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 DOT 001550 DOT 1040828527127506667 DOT trueroad AT trueroad DOT jp> In-Reply-To: <20180814.001550.1040828527127506667.trueroad@trueroad.jp> From: Stephen John Smoogen Date: Mon, 13 Aug 2018 12:52:48 -0400 Message-ID: Subject: Re: `std::stod ("nan")` returns negative NaN To: cygwin AT cygwin DOT com Cc: trueroad AT trueroad DOT jp Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes 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