json negative floats throws bad_cast
Brought to you by:
artyom-beilis
double r=v.number();
if( r < std::numeric_limits<float>::min()
|| std::numeric_limits<float>::max() < r )
{
throw bad_value_cast();
std::numeric_limits<float>::min() rules out negative floats IMHO.
The JSON standards allows negative numbers as values, if I am correct.
cmmcps version is 1.0.5
Anonymous
Thank You,
Yes you are correct, I incorrectly assumed that std::numeric_limits<float>::min() returns real minimal value rather than minimal positive value.
I'll fix it.
Thanks for the fast reaction. :-)
Sorry, by no means I wanted to post this anonymously..
I'm using the JSON serializer for more than just reading configurations: for a
webservice using JSON as communication protocol. That's why I'm hitting some
corner cases right now, I think.
Fixed in 2413