2020 21 4b

Computer Organization and Architecture2020-2110 marksNumericalIEEE Standard for Floating Point Numbers

Explain IEEE standard for floating point representation. Represent the number (-1460.125)10 in single precision and double precision format.

Explain IEEE standard for floating point representation. Represent the number (-1460.125)10 in single precision and double precision format.

IEEE 754 is the standard way to store real numbers in a computer. A number is written in the form $(-1)^s \times 1.f \times 2^{e}$ and stored in three fields: a sign bit $s$, a biased exponent $E$, and a fraction $f$ (also called the mantissa). The leading 1 is implied, so it is not stored.

FormatTotal bitsSignExponentFractionBias
Single precision321823127
Double precision64111521023

The stored exponent is $E = e + \text{bias}$. The bias lets the exponent field hold negative powers of 2 without its own sign. Single precision covers magnitudes from about $1.2 \times 10^{-38}$ to $3.4 \times 10^{38}$. The all-0 and all-1 exponent patterns are kept for zero, denormal numbers, infinity and NaN.

Representing -1460.125

The number is negative, so the sign bit is $1$. Convert the magnitude to binary. The integer part is $1460 = 10110110100_2$. The fraction is exact, since $0.125 = 0.001_2$. So:

$$1460.125 = 10110110100.001_2$$

Move the binary point 10 places left to normalise:

$$1460.125 = 1.0110110100001_2 \times 2^{10}$$

The fraction is $0110110100001$, and the true exponent is $e = 10$.

Single precision. The stored exponent is:

$$E = 10 + 127 = 137 = 10001001_2$$

The fraction is padded with zeros to 23 bits. Therefore:

SignExponentFraction
11000100101101101000010000000000

In hexadecimal this is $\text{0xC4B68400}$.

Double precision. The stored exponent is:

$$E = 10 + 1023 = 1033 = 10000001001_2$$

The fraction is padded with zeros to 52 bits. Therefore:

SignExponentFraction
1100000010010110110100001 followed by 39 zeros

In hexadecimal this is $\text{0xC096D08000000000}$.

Special values. The reserved exponent patterns give the following meanings:

ExponentFractionMeaning
all 00zero (positive or negative)
all 0not 0denormal number (no implied 1)
all 10infinity (positive or negative)
all 1not 0NaN (not a number, such as $0/0$)

Check. To decode the single precision answer, read $E = 137$, so $e = 137 - 127 = 10$. The value is $-1.0110110100001_2 \times 2^{10}$. Shifting the point 10 places right gives $-10110110100.001_2$, which is $-1460.125$. So the encoding is correct.

Both representations are exact, because the number needs only 13 fraction bits. Double precision stores the same value but has a wider range and about 15 to 16 decimal digits of accuracy, against about 7 for single precision.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.

Up nextWhat is a micro program sequencer? With block diagram, explain the working of micro progra