CS302 Assignment 1
CS302 Assignment 1
Bc220203574
11000100110110101011010111000111
Solution:
The 32-bit floating-point number is represented as follows:
Given:
S=1
E = 10001001
M = 10110101011010111000111
Exponent Conversion:
E = 10001001
= (1 × 2^7) + (0 × 2^6) + (0 × 2^5) + (0 × 2^4) + (1 × 2^3) + (0 × 2^2) + (0 × 2^1) + (1 × 2^0)
= (1 × 128) + (0 × 64) + (0 × 32) + (0 × 16) + (1 × 8) + (0 × 4) + (0 × 2) + (1 × 1)
= 128 + 0 + 0 + 0 + 8 + 0 + 0 + 1
= 137
Unbiased Exponent:
e = E - 127
= 137 - 127
= 10
Mantissa Normalization:
M = 10110101011010111000111
= 1.0110101011010111000111 (normalized)
Mantissa Conversion:
Multiply each digit by 2 raised to the power of its position from right to left, starting with -
1:
1 × 2^0 = 1
0 × 2^-1 = 0
1 × 2^-2 = 0.25
1 × 2^-3 = 0.125
0 × 2^-4 = 0
1 × 2^-5 = 0.03125
0 × 2^-6 = 0
1 × 2^-7 = 0.0078125
1 × 2^-8 = 0.00390625
0 × 2^-9 = 0
1 × 2^-10 = 0.0009765625
1 × 2^-11 = 0.00048828125
1 × 2^-12 = 0.000244140625
1 × 2^-13 = 0.0001220703125
1 × 2^-14 = 0.00006103515625
0 × 2^-15 = 0
0 × 2^-16 = 0
0 × 2^-17 = 0
1 × 2^-18 = 0.000003814697265625
1 × 2^-19 = 0.0000019073486328125
1 × 2^-20 = 0.00000095367431640625
0 × 2^-21 = 0
0 × 2^-22 = 0
0 × 2^-23 = 0
Add these values together:
1 + 0 + 0.25 + 0.125 + 0 + 0.03125 + 0 + 0.0078125 + 0.00390625 + 0 + 0.0009765625 +
0.00048828125 + 0.000244140625 + 0.0001220703125 + 0.00006103515625 + 0 + 0 + 0 +
0.000003814697265625 + 0.0000019073486328125 + 0.00000095367431640625
≈ 1.718281828
Rounded to 10 decimal places.
Applying Exponent:
x = (-1)^S × M × 2^e
= (-1)^1 × 1.718281828 × 2^10
= -1 × 1.718281828 × 1024
= -1 × 1755.77
Final Answer:
-1755.77