32 bit IEEE 754 floating point representation
1 bit Sign (S) |
8 bits Exponent (E) |
23 bits Mantissa(M) |
Representation: number = (-1)S * (1.M) *
2E-127
Givennumber:0.000101
(i)Consideringthegivennumberisindecimal
- 1) 0.000 101 × 2 = 0 + 0.000 202;
- 2) 0.000 202 × 2 = 0 + 0.000 404;
- 3) 0.000 404 × 2 = 0 + 0.000 808;
- 4) 0.000 808 × 2 = 0 + 0.001 616;
- 5) 0.001 616 × 2 = 0 + 0.003 232;
- 6) 0.003 232 × 2 = 0 + 0.006 464;
- 7) 0.006 464 × 2 = 0 + 0.012 928;
- 8) 0.012 928 × 2 = 0 + 0.025 856;
- 9) 0.025 856 × 2 = 0 + 0.051 712;
- 10) 0.051 712 × 2 = 0 + 0.103 424;
- 11) 0.103 424 × 2 = 0 + 0.206 848;
- 12) 0.206 848 × 2 = 0 + 0.413 696;
- 13) 0.413 696 × 2 = 0 + 0.827 392;
- 14) 0.827 392 × 2 = 1 + 0.654 784;
- 15) 0.654 784 × 2 = 1 + 0.309 568;
- 16) 0.309 568 × 2 = 0 + 0.619 136;
- 17) 0.619 136 × 2 = 1 + 0.238 272;
- 18) 0.238 272 × 2 = 0 + 0.476 544;
- 19) 0.476 544 × 2 = 0 + 0.953 088;
- 20) 0.953 088 × 2 = 1 + 0.906 176;
- 21) 0.906 176 × 2 = 1 + 0.812 352;
- 22) 0.812 352 × 2 = 1 + 0.624 704;
- 23) 0.624 704 × 2 = 1 + 0.249 408;
- 24) 0.249 408 × 2 = 0 + 0.498 816;
- 25) 0.498 816 × 2 = 0 + 0.997 632;
- 26) 0.997 632 × 2 = 1 + 0.995 264;
- 27) 0.995 264 × 2 = 1 + 0.990 528;
- 28) 0.990 528 × 2 = 1 + 0.981 056;
- 29) 0.981 056 × 2 = 1 + 0.962 112;
- 30) 0.962 112 × 2 = 1 + 0.924 224;
- 31) 0.924 224 × 2 = 1 + 0.848 448;
- 32) 0.848 448 × 2 = 1 + 0.696 896;
- 33) 0.696 896 × 2 = 1 + 0.393 792;
- 34) 0.393 792 × 2 = 0 + 0.787 584;
- 35) 0.787 584 × 2 = 1 + 0.575 168;
- 36) 0.575 168 × 2 = 1 + 0.150 336;
- 37) 0.150 336 × 2 = 0 + 0.300 672;
and so on..
So,
0.000101(10) =
0.0000000000000110100111100111111110110(2)
= 1.10100111100111111110110(2) × 2-14
Now let's adjust the expont
(-14 + 127)(10) = 113(10)
- 113 ÷ 2 = 56 + 1;
- 56 ÷ 2 = 28 + 0;
- 28 ÷ 2 = 14 + 0;
- 14 ÷ 2 = 7 + 0;
- 7 ÷ 2 = 3 + 1;
- 3 ÷ 2 = 1 + 1;
- 1 ÷ 2 = 0 + 1;
So, (113)10 = 01110001(2)
Sign bit will be 0 since given number is positive
Therefore, (0.000101)10
is represented in 32 bit IEEE
floating point representation as
follows
0 |
01110001 |
10100111100111111110110 |
(ii) Considering the given number is in
binary
(0.000101)2 = (1.01000000000000000000000)2
* 2-4
Now let's adjust the expont
(-4+127)10 = (123)10
- 123 ÷ 2 = 61 + 1;
- 61 ÷ 2 = 30 + 1;
- 30 ÷ 2 = 15 + 0;
- 15 ÷ 2 = 7 + 1;
- 7 ÷ 2 = 3 + 1;
- 3 ÷ 2 = 1 + 1;
- 1 ÷ 2 = 0 + 1;
(123)10 = (01111011)2
Sign bit will be 0, since given number is positive.
Therefore (0.000101)2 is represented in 32
bit IEEE floating point representation as follows
0 |
01111011
|
01000000000000000000000 |