F1: printf (" % f \ n ", f1);
Printf (" f1: % x \ n ", f1);
Float in the IEEE standard for 32 digits, 31 as the sign bit, [31, 23] for index, 22, 0 for the mantissa bits,
0 x3d800005 binary number is:
00111101100000000000000000001001
The segmented words in the following format
| | the sign bit 0
01111011 | | for index, and its algorithm for 127-3 turn binary
01001 | | 0... for mantissa
According to the rules to the output should be 1.125 but the output is 0 x3d800005 decimal turn the value of the float, excuse me how to use 8 hexadecimal number directly to create a float
CodePudding user response:
The union U {Float f;
Int d;
} u;
U.d=0 x3d800005;
Printf (" % f \ n ", u.f);