Web lists-archives.com

Re: strtod ("nan") returns negative NaN

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"}'

the numeric value of the *numeric string* shall be the value that would be
returned by the strtod() call


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