Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6571: lexical_case<float>(someString) does not recognize IEEE exceptions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-24 10:23:10
#6571: lexical_case<float>(someString) does not recognize IEEE exceptions
-----------------------------------------------------+----------------------
Reporter: Chromatix <mhazadmanesh2009@â¦> | Owner: apolukhin
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: lexical_cast
Version: Boost 1.48.0 | Severity: Problem
Resolution: | Keywords:
-----------------------------------------------------+----------------------
Comment (by Chromatix <mhazadmanesh2009@â¦>):
Oops, it seems I mixed up boost versions.
My boost on Windows was 1.47 which is why
`boost::lexical_cast<string>(sqrt(-1.0))` returned `-1.#IND` on Visual
Studio (it's 2010 btw). On 1.48 it returns `-nan` and can be converted
back to double.[[BR]]
So a major part of this bug report doesn't make sense now. Sorry about the
mistake here. :(
However, the title question still makes sense about `-1.#IND`. Neither
`nan` nor `-1.#IND` are global standards. `-nan` is the standard on *nix
(and GCC on windows), but all Microsoft compilers (since VS5 and even
before that I guess) represent the error value as `-1.#IND`, `1.#QNAN`,
etc. (Simply try `cout << sqrt(-1.0)`). So I think it's essential to
implement such a conversion: `boost::lexical_cast<double>("-1.#IND")` to
work. Since with a Microsoft compiler one might occasionally encounter the
`-1.#IND` and other error strings generated by conversion methods other
than boost::lexical_cast or from external libraries.
I also found this: http://en.wikipedia.org/wiki/NaN#Display.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6571#comment:7> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC