| delorie.com/archives/browse.cgi | search |
| 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:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=JcFioTSrVMazLUn6 | |
| Z8zEoWGMzd54slD8TfwF/61ZZ/slBG293S/8tpoDS7X0bmz0PXQZv5M4Mxsfme1U | |
| n+DlC57F5Cg5DLmW/CL7yc9v1+e6Fx0qd1veaEJclBWAVfCkJkGjcslPQxgIVFnU | |
| adhth4suhKwyh/efmbQYsluapqc= | |
| 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:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; s=default; bh=EHtERZ1pfS2MalG529nd7e | |
| QutoY=; b=AsZmsxSWJ+/X1MF08yXzrYusm3f93Vmy8E5xC30RLhXBUge2O9eVkf | |
| nP20n40/gld0f55Bsk5CcP3iECeSCZHs0NGzDHdx63tuqc+Js/Ek1MPR2B0DhsV/ | |
| PO5cmEY6a5rPjvuo6J1xGtWxMdR7w4ynCy1BIYWn+MQtqEWK0fiDU= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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,SPF_PASS,WEIRD_QUOTING autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit |
| X-HELO: | mail.avenger.ws |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/simple; d=avenger.ws; s=ethereal; t=1534262714; bh=NF3gGNRKlU4xYsXNZcQWXXbzCWO4EULBATTLmy7aqWA=; h=Subject:To:References:From:Date:In-Reply-To; b=5ytofuAQ4jS7M8lZ3JXDfU1LAV0GdZBuT7zYXGCfS0vcNjGleUEqCo9ZvTbAUkYxF 1pAvlIBkXlHp6qUIPV/p2Ax/FGLIu9aHNDpTt1VgEslAbc5HHtFaAilIxpsqlWm1uy k2GBH/1XQT3qGT9zwx2Vz9GGXfcOrFVXX7gFoWZY= |
| Subject: | Re: strtod ("nan") returns negative NaN |
| To: | cygwin AT cygwin DOT com |
| References: | <20180814095618 DOT GT3747 AT calimero DOT vinschen DOT de> <20180814095618_dot_GT3747_at_calimero_dot_vinschen_dot_de> <20180814103900 DOT GU3747 AT calimero DOT vinschen DOT de> <20180814 DOT 211757 DOT 2066454831159853501 DOT trueroad AT trueroad DOT jp> <20180814132301 DOT GX3747 AT calimero DOT vinschen DOT de> <1e04c237-70f8-5cc9-7dae-d00e3bfea39d AT avenger DOT ws> <20180814153528 DOT GY3747 AT calimero DOT vinschen DOT de> |
| From: | Heavenly Avenger <avenger AT avenger DOT ws> |
| Message-ID: | <c351c1c2-dac0-b4c4-b640-a749ec3254fa@avenger.ws> |
| Date: | Tue, 14 Aug 2018 13:04:32 -0300 |
| User-Agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
| MIME-Version: | 1.0 |
| In-Reply-To: | <20180814153528.GY3747@calimero.vinschen.de> |
| X-IsSubscribed: | yes |
Well, that's what I get in linux and cygwin for:
#include <stdio.h>
#include <stdlib.h>
#include <math.h> /* the last two printfs requires this */
int main (void) {
 printf ("strtof (\"nan\", NULL) = %f\n", strtof ("nan", NULL));
 printf ("strtof (\"-nan\", NULL) = %f\n", strtof ("-nan", NULL));
 printf ("strtod (\"nan\", NULL) = %f\n", strtod ("nan", NULL));
 printf ("strtod (\"-nan\", NULL) = %f\n", strtod ("-nan", NULL));
 printf ("strtold (\"nan\", NULL) = %Lf\n", strtold ("nan", NULL));
 printf ("strtold (\"-nan\", NULL) = %Lf\n", strtold ("-nan", NULL));
 printf ("nan (\"\") = %f\n", nan (""));
 printf ("-nan (\"\") = %f\n", -nan (""));
}
I get:
Gentoo Linux (native linux)
strtof ("nan", NULL) = nan
strtof ("-nan", NULL) = nan
strtod ("nan", NULL) = nan
strtod ("-nan", NULL) = nan
strtold ("nan", NULL) = nan
strtold ("-nan", NULL) = nan
nan ("") = nan
-nan ("") = -nan
cygwin 2.10.0:
strtof ("nan", NULL) = nan
strtof ("-nan", NULL) = nan
strtod ("nan", NULL) = -nan
strtod ("-nan", NULL) = nan
strtold ("nan", NULL) = -nan
strtold ("-nan", NULL) = -nan
nan ("") = nan
-nan ("") = -nan
So, let's hope the patch does not transform the behavior from the nan
from math.h.
And yes, you have a good point. Just, well, different people made those
different parts of the code so, better cygwin follow the ""convention"",
if we can call it, that. :)
On 8/14/2018 12:35 PM, Corinna Vinschen wrote:
> printf ("nan (\"\") = %f\n", nan (""));
> printf ("-nan (\"\") = %f\n", -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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |