boostorg/convert

`boost::cnv::printf` uses wrong format for str to double

dvirtz opened this issue · 1 comments

The correct sscanf format for double is %lf while current code uses %f:

static char const* d_fmt[] = { "%f", "%f", "%d", "%u", "%hd", "%hu", "%ld", "%lu" }; // Must match managed_types

This results in wrong value when converting a string to double:

fmt::print("{}\n", boost::convert<double>("3.14", cnv).value()); // prints 5.32861326e-315

https://gcc.godbolt.org/z/q1f1PK1cM

Indeed. Thank you for picking it up. Much appreciated. Fixed in the develop branch. Should make it to the master branch the the next release. Tnx again.