The C++ standard does not discuss the underlying layout of float and double types, only the range of values they should represent. (This is also true for signed types, is i
What's wrong with a human readable format.
It has a couple of advantages over binary:
Disadvantage:
htonl())To output a double at full precision:
double v = 2.20;
std::cout << std::setprecision(std::numeric_limits::digits) << v;
OK. I am not convinced that is exactly precise. It may lose precision.