written 2.8 years ago by | • modified 2.4 years ago |
Single-Precision IEEE 754 Floating-Point Standard
Single-Precision IEEE 754 Floating-Point Standard look as follows:
$0^{th}$ bit represent Sign bit. (1 bit)
$1^{th}$ to $8^{th}$ bits represents Exponents. (8 bits)
$9^{th}$ to $31^{st}$ bits represents Mantissa also called Number or Significand. (23 bits)
Now, here the given number = 125.025
1] Sign Bit Calculation:
The given number is Positive.
Therefore,
Sign bit = 0
2] Mantissa or Significand Bits Calculation:
First, Convert 125 into binary format
$$ (125)_{10} = (1111101)_2 $$
Second, look at the fraction part now that is 0.025
Multiply this Fraction part value with 2 and Stop when we get a fractional part that is equal to zero..
Therefore,
1] 0.025 × 2 = $\implies 0 + 0.05 $
2] 0.05 × 2 = $\implies 0 + 0.1 $
3] 0.1 × 2 = $\implies 0 + 0.2 $
4] 0.2 × 2 = $\implies 0 + 0.4 $
5] 0.2 × 2 = $\implies 0 + 0.8 $
6] 0.8 × 2 = 1.6 $\implies 1 + 0.6 $
7] 0.6 × 2 = $\implies 1 + 0.2 $
8] 0.2 × 2 = $\implies 0 + 0.4 $
9] 0.4 × 2 = $\implies 0 + 0.8 $
10] 0.8 × 2 = $\implies 1 + 0.6 $
11] 0.6 × 2 = $\implies 1 + 0.2 $
12] 0.2 × 2 = $\implies 0 + 0.4 $
13] 0.4 × 2 = $\implies 0 + 0.8 $
14] 0.8 × 2 = $\implies 1 + 0.6 $
15) 0.6 × 2 = $\implies 1 + 0.2 $
16] 0.2 × 2 = $\implies 0 + 0.4 $
17] 0.4 × 2 = $\implies 0 + 0.8 $
18] 0.8 × 2 = $\implies 1 + 0.6 $
19] 0.6 × 2 = $\implies 1 + 0.2 $
20] 0.2 × 2 = $\implies 0 + 0.4 $
21] 0.4 × 2 = $\implies 0 + 0.8 $
22] 0.8 × 2 = $\implies 1 + 0.6 $
23] 0.6 × 2 = $\implies 1 + 0.2 $
24] 0.2 × 2 = $\implies 0 + 0.4 $
We didn't get any fractional part that was equal to zero.
But we had enough iterations (over Mantissa limit) and at least one integer that was different from zero => FULL STOP (losing precision...)
Write numbers from top to bottom direction.
Therefore,
$$ (0.025)_{10} = (0.000001100110011001100110)_2 $$
Complete Binary form of the given number is
$$ (125.025)_{10} = (1111101.000001100110011001100110)_2 $$
Third, Convert this Complete binary format into Exponent format
Therefore,
$$ 1111101.000001100110011001100110 \implies 1.111101000001100110011001100110 \times 2^6 $$
Discard 1 and take 111101000001100110011001100110 as Mantissa or Significand
Now, remove the excess bits and adjust the length of Mantissa to 23 bits.
Therefore,
Mantissa holds = 11110100000110011001100
3] Exponent Bits Calculation:
Because it is a single-precision biased exponent hence 127 + 6 = 133 ......(+6 is the Exponent)
Exponent Number $$ (133)_{10} = (10000101)_2 $$
Exponent holds = 10000101
4] Complete Single-Precision Format:
Hence, the Complete Single-Precision IEEE 754 Floating-Point Representation of 125.025 looks as follows:
$$ Sign\ Bit + Exponent\ Bits + Mantissa\ or\ Significand\ Bits $$
$$ 125.025 = 0\ 10000101\ 11110100000110011001100 $$
This is written in hexadecimal form as 42FACCC.