※ Floating point to IEEE code
1. Float type IEEE code (31,30~23,22~0=> sign bit, digit digit, tail digit)
eg1:12.25 after the IEEE-encoded situation:
Sign bit: 0
Digits: 3+127, 10000010
Number of digits: 10001000000000000000000
4 byte binary: 0x41440000
vc6.0:
EG2:-0.125 after the IEEE-encoded situation:
Sign bit: 1
Digits: -3+127, 01111100
Number of digits: 00000000000000000000000
4 byte binary: 0xbe000000
vc6.0:
eg3:1.3 after the IEEE-encoded situation:
Sign bit: 0
Digits: 0+127, 01111111
Number of digits: 01001100110011001100110
4 byte binary: 0x3fa66666
vc6.0:
Because the 1.3f after the IEEE code will be lost precision, so we see the following phenomenon, ffloat3!=1.3, so in the floating-point comparison should be compared with the interval can not be directly compared.
2. IEEE code for Double type (63,62~52,51~0=> sign bit, digit, tail digit)
eg1:12.25 after the IEEE-encoded situation:
Sign bit: 0
Digits: 3+1023, 10000000010
Number of digits: 1000100000000000000000000000000000000000000000000000
4 byte binary: 0x4028800000000000
vc6.0:
EG2:-0.125 after the IEEE-encoded situation:
Sign bit: 1
Digits: -3+1023, 01111111100
Number of digits: 0000000000000000000000000000000000000000000000000000
4 byte binary: 0xbfc0000000000000
vc6.0:
eg3:1.3 after the IEEE-encoded situation:
Sign bit: 0
Digits: 0+1023, 01111111111
Number of digits: 0100110011001100110011001100110011001100110011001100
4 byte binary: 0X3FF4CCCCCCCCCCCC
vc6.0:
Above, is the floating point to IEEE code simple introduction.
"The Secret of Anti-compilation and reverse analysis technology in C + +" Learning note 01--floating point to IEEE code