Subject: [Boost-bugs] [Boost C++ Libraries] #6571: lexical_case<double>(someString) does not recognize IEEE exceptions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-17 16:30:41
#6571: lexical_case<double>(someString) does not recognize IEEE exceptions
----------------------------------------------------+-----------------------
Reporter: Chromatix <mhazadmanesh2009@â¦> | Owner: apolukhin
Type: Bugs | Status: new
Milestone: To Be Determined | Component: lexical_cast
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
----------------------------------------------------+-----------------------
When using lexical_cast to cast a floating point value (float, double,
long double), lexical_cast will generate the proper IEEE floating-point
exception string.
But when converting the string representation to the real floating point
value, lexical_cast doesn't recognize the special values and throws
bad_lexical_cast. Look at this example trying to work with double
undefined values. The same problem exists for infinity (and probably for
other special values that I'm not aware of).
{{{
#include <boost/lexical_cast.hpp>
int main()
{
boost::lexical_cast<string>(sqrt(-1.0)); //OK, returns "-1.#IND"
boost::lexical_cast<double>("-1.#IND"); //bad_lexical_cast !!!
return 0;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6571> 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