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-23 20:28:14
#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@â¦>):
I'm not specifically speaking about '''-1.#IND'''. lexical_cast fails to
convert '''-nan''' and '''inf''' from a string type to their floating
point values too.
If lexical_cast is able to successfully convert the double `undefined`
value to its string representation (`-1.#IND`, `-nan`, etc) then it must
also be able to do the vice versa without throwing errors, No?
If you're wondering why it makes sense to implement such a conversion: I'm
working on a program that frequently reads/writes double's to/from file.
In the program calculations, sometimes undefined or infinity values are
generated (which are fine and sometimes necessary in the program's logic).
Now I have no problem saving them to disk (since '''{{{
lexical_cast<string>(someUndefinedDouble) }}}''' works) but can't read
them back (since e.g '''{{{ lexical_cast<double>("-nan") }}}''' fails).
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6571#comment:5> 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