strtod ("nan") returns negative NaN
Steven Penny
svnpenn@gmail.com
Tue Aug 14 03:25:00 GMT 2018
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 of `std::strtod ()`.
>
> ```
> inline double
> stod(const string& __str, size_t* __idx = 0)
> { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); }
> ```
>
> `__gnu_cxx::__stoa ()` is defined in
> /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/ext/string_conversions.h L51-.
> It calls the first parameter, `std::strtod ()`.
>
> `std::strtod ()` is cygwin1.dll's `strtod ()`.
Ah, so thats why this is happening:
$ awk 'BEGIN {print +"nan"}'
-nan
> the numeric value of the *numeric string* shall be the value that would be
> returned by the strtod() call
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html#tag_20_06_13_02
--
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
More information about the Cygwin
mailing list