Because it is not a valid (or good) float value.
EDIT: Bad example. Better example below.
Storing multiple bytes in one container can be achieved as:
But mapping a float to chars and the reverse is not done through a union.Code:#include <iostream> #include <boost/array.hpp> int main() { boost::array<unsigned char, 4> e; e[0] = 0xFF; e[1] = 0x00; e[2] = 0xFF; e[3] = 0x00; std::cout << std::hex << (int)e[0] << (int)e[1] << (int)e[2] << (int)e[3] << std::endl; }



LinkBack URL
About LinkBacks




The starting point is a valid float value. Can you redo the test but with a float that gets converted to chars[4] and back?