On 2018-08-14 13:24, Achim Gratz wrote:
> Corinna Vinschen writes:
>> With your patch, strtold looks more correct, but it still prints the
>> sign of NaN:
>>
>> strtod ("nan", NULL) = nan
>> strtod ("-nan", NULL) = nan
>> strtold ("nan", NULL) = nan
>> strtold ("-nan", NULL) = -nan
>> nan
On 2018-08-14 15:44, Eric Blake wrote:
> On 08/14/2018 04:31 PM, Stephen John Smoogen wrote:
>>> The C standard disagrees with you [ISO:IEC 9899:2011, section 5.2.4.2.2]:
>>> "An implementation may give zero and values that are not floating-point
>>> numbers (such as infinities and NaNs) a sign or
gt;From 91cf4a20e0773f4a38d6d56b0867fe3725859e5e Mon Sep 17 00:00:00 2001
From: Masamichi Hosoda
Date: Tue, 14 Aug 2018 22:29:34 +0900
Subject: [PATCH v2 1/2] Fix strtod ("nan") returns negative NaN
The definition of qNaN for x86_64 and i386 was wrong.
So strtod ("nan") and st
On Tue, 14 Aug 2018 16:44:59, Eric Blake wrote:
The remaining question is whether it should turn "-NaN" into
-NaN; and the argument that glibc JUST fixed their bug 23007 to make
strtod("-nan") return -NaN means that Cygwin should, indeed, preserve
the negative sign bit when parsing "-nan".
ht
On 08/14/2018 04:31 PM, Stephen John Smoogen wrote:
The C standard disagrees with you [ISO:IEC 9899:2011, section 5.2.4.2.2]:
"An implementation may give zero and values that are not floating-point
numbers (such as infinities and NaNs) a sign or may leave them unsigned.
Wherever such values are
On Tue, 14 Aug 2018 at 17:09, Andy Moreton wrote:
>
> On Tue 14 Aug 2018, Steven Penny wrote:
> > a number can be positive or negative. as "NaN" is by definition not a
> > number,
> > it cannot be positive or negative, it is simply itself, something anathema
> > to
> > a number.
>
> The C standa
On Tue 14 Aug 2018, Steven Penny wrote:
> a number can be positive or negative. as "NaN" is by definition not a number,
> it cannot be positive or negative, it is simply itself, something anathema to
> a number.
The C standard disagrees with you [ISO:IEC 9899:2011, section 5.2.4.2.2]:
"An impleme
On Wed, 15 Aug 2018, Masamichi Hosoda wrote:
> On Linux with glibc, both strtod ("nan")
> and strtod ("-nan") return positive NaN.
>
> So I've created the patch that behaves like glibc.
> Both strtod ("nan") and strtod ("-nan") return positive NaN.
I would suggest that you should not consider fi
Corinna Vinschen writes:
> With your patch, strtold looks more correct, but it still prints the
> sign of NaN:
>
> strtod ("nan", NULL) = nan
> strtod ("-nan", NULL) = nan
> strtold ("nan", NULL) = nan
> strtold ("-nan", NULL) = -nan
> nan ("") = nan
>
> Question: What's wrong with that?
On Tue, 14 Aug 2018 15:23:01, Corinna Vinschen wrote:
I just wonder why returning -NaN when the input is "-nan" isn't the
better approach. After all:
printf ("nan (\"\") =3D %f\n", nan (""));
printf ("-nan (\"\") =3D %f\n", -nan (""));
=3D=3D>
nan ("") =3D nan
-nan ("") =3D -nan
So,
Well, that's what I get in linux and cygwin for:
#include
#include
#include /* 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\
,
>> strtold sets sign bit when parameter has '-' character.
>> The wrong long double NaN definition is negative NaN that is set sign bit.
>> So without my patch, both strtold ("nan") and
>> strtold ("-nan") return negative NaN.
>>
>> On
On Aug 14 12:20, Heavenly Avenger wrote:
> On 8/14/2018 10:23 AM, Corinna Vinschen wrote:
> > I just wonder why returning -NaN when the input is "-nan" isn't the
> > better approach. After all:
> >
> >printf ("nan (\"\") = %f\n", nan (""));
> >printf ("-nan (\"\") = %f\n", -nan (""));
> >
NULL) = nan
strtod ("nan", NULL) = nan
strtod ("-nan", NULL) = nan
strtold ("nan", NULL) = nan
strtold ("-nan", NULL) = nan
This further supports the reasoning to always return just 'nan'.
On 8/14/2018 12:05 PM, Masamichi Hosoda wrote:
Hi
an") return negative NaN.
On the other hand, strtod inverts the sign when parameter has '-' character.
The wrong double NaN definition is negative NaN.
So without my patch, strtod ("nan") returns negative NaN
and strtod ("-nan") returns positive NaN.
Your pa
Hi
I've found that strtod ("nan") returns negative NaN on Cygwin 64 bit.
https://cygwin.com/ml/cygwin/2018-08/msg00168.html
On Linux with glibc, both strtod ("nan")
and strtod ("-nan") return positive NaN.
So I've created the patch that behaves like glib
th that? Wouldn't it be more correct if
> > > strtod returns -NaN for "-nan" as well?
> >
> > In my investigate,
> > strtold sets sign bit when parameter has '-' character.
> > The wrong long double NaN definition is negative NaN that is s
n
> > nan ("") = nan
> >
> > Question: What's wrong with that? Wouldn't it be more correct if
> > strtod returns -NaN for "-nan" as well?
>
> In my investigate,
> strtold sets sign bit when parameter has '-' character.
> Th
> strtod ("-nan", NULL) = nan
> strtold ("nan", NULL) = nan
> strtold ("-nan", NULL) = -nan
> nan ("") = nan
>
> Question: What's wrong with that? Wouldn't it be more correct if
> strtod returns -NaN for "-nan" as w
On Aug 14 11:56, Corinna Vinschen wrote:
> On Aug 14 13:45, Masamichi Hosoda wrote:
> > >From a50ee5a4747a99c70469a53fe959f3dc22d3b79a Mon Sep 17 00:00:00 2001
> > From: Masamichi Hosoda
> > Date: Tue, 14 Aug 2018 12:50:32 +0900
> > Subject: [PATCH] Fix strtod ("nan") returns qNaN
> >
> > The def
On Aug 14 13:45, Masamichi Hosoda wrote:
> >From a50ee5a4747a99c70469a53fe959f3dc22d3b79a Mon Sep 17 00:00:00 2001
> From: Masamichi Hosoda
> Date: Tue, 14 Aug 2018 12:50:32 +0900
> Subject: [PATCH] Fix strtod ("nan") returns qNaN
>
> The definition of qNaN for x86_64 and x86 was wrong.
> So strt
>>> On Mon, 13 Aug 2018 at 19:46, Duncan Roe wrote:
On Mon, Aug 13, 2018 at 12:52:48PM -0400, Stephen John Smoogen wrote:
> On Mon, 13 Aug 2018 at 11:16, Masamichi Hosoda
> wrote:
[...]
> On Fedora 27 with 7.3.1 it gives
> ```
> stod ("nan") = nan
> s
On Tue, 14 Aug 2018 11:31:35, Masamichi Hosoda wrote:
If I understand correctly,
`std::stod ()` uses cygwin1.dll's `strtod ()` for the conversion.
`std::stod ()` is defined in
/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/bits/basic_string.h L6388-.
It calls `__gnu_cxx::__stoa ()` with pointer
>> On Mon, 13 Aug 2018 at 19:46, Duncan Roe wrote:
>>>
>>> On Mon, Aug 13, 2018 at 12:52:48PM -0400, Stephen John Smoogen wrote:
>>> > On Mon, 13 Aug 2018 at 11:16, Masamichi Hosoda
>>> > wrote:
>>> [...]
>>> > On Fedora 27 with 7.3.1 it gives
>>> > ```
>>> > stod ("nan") = nan
>>> > stod ("-nan
24 matches
Mail list logo