In my C++ code I have declared a union:
typedef union U_FloatParse {
float float_data;
unsigned char byte_data[4];
} U_FloatConvert;
Then, I set the byte_data array to the values 0, 0, 192, 127:
U_FloatConvert depth_data;
depth_data.byte_data[0] = 0;
depth_data.byte_data[1] = 0;
depth_data.byte_data[2] = 192;
depth_data.byte_data[3] = 127;
printf("\n\nFloat = %f\n\n", depth_data.float_data);
As output I get NaN. Why don't I get a normal float value? When I pass the values: 56, 137, 33, 63. I get the float value 0.631000.
Test code: http://codepad.org/Q8ds1V0F