"The Secret of Anti-compilation and reverse analysis technology in C + +" Learning note 01--floating point to IEEE code

Source: Internet
Author: User

※ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.