|
Boost Users : |
From: Chris Surridge (csurridge_at_[hidden])
Date: 2004-05-27 14:16:20
I was testing out lexical_cast, and I would expect that for any value v of
type T, it should be true that
v == lexical_cast<T>(lexical_cast<string>(v))
but this does not appear to work for float or double in all cases. In
particular, the following tests failed:
float value = numeric_values<float>::min();
BOOST_CHECK_EQUAL(value, lexical_cast<float>(lexical_cast<string>(value)));
value = numeric_values<float>::max();
BOOST_CHECK_EQUAL(value, lexical_cast<float>(lexical_cast<string>(value)));
double dvalue = numeric_values<double>::min();
BOOST_CHECK_EQUAL(dvalue,
lexical_cast<double>(lexical_cast<string>(dvalue)));
dvalue = numeric_values<double>::max();
BOOST_CHECK_EQUAL(dvalue,
lexical_cast<double>(lexical_cast<string>(dvalue)));
Should I have expected these tests to pass?
thanks,
--chris
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net