float data stored in memory is how the

a digital computer with a float in stored in 4 bytes. It follows the IEEE-754 standard format:
a floating-point number has two parts: the base-m and exponent e

Base-part binary numbers to represent the actual value of the floating-point
binary number of 8bit exponent portion occupied, may represent values ranging 0-255

But the index can be positive or negative, so, IEEE provisions, calculated here is the real power must be reduced by 127 index.
Therefore, float type from index -126 to 128

Base number is a fraction of the actual value of occupied 24bit, but the most significant bit is always 1, thus, eliminating the need for the highest level is not stored in the storage accounts for 23bit
scientific notation.

Format:
SEEE EMMM EEEE MMMM MMMM MMMM MMMM MMMM
S represents the positive and negative floating point
E index plus binary data worth 127
M in base

Example:
17.625 stored in memory

We must first be converted into a binary 17.625: 10001.101

Integer part, divided by two until the quotient is zero, the remainder reversed.
Fractional part, is multiplied by 2 until bit 0 by the carry are sequentially fetched.

10001.101 in the right until the front left of the decimal point one:
1.0001101 * 2 ^ 4 as right movement of the four

This time, our base number and index came out
in base: because the first decimal point will be for 1, so only records like IEEE specified after the decimal point. So, here's base number is: 0001101
Index: 4 actual, must be added 127 (roll-out time, minus 127), it was 131. 10000011 i.e.
symbol part being an integer, so that 0
summary, 17.625 format stored in memory is:
0,100,000,110,001,101 00000000 00000000

 

Guess you like

Origin www.cnblogs.com/zyk2019/p/11311179.html