6. Using IEEE 754 representation for single precision floating point, give the 32. bit binary encoding for the numbers below. Show the sign, exponent, and mantissa (significand). a. -2.40625 b. 11.2265625
Can please help with part a and b and show work
a. -2.40625:
The sign bit for negative numbers is 1, so we mark the number as negative. The integer part of the number is 2, and the fractional part is 0.40625. We can convert the integer part to binary by dividing by 2 repeatedly until we reach 0:
2 / 2 = 1, remainder 0
1 / 2 = 0, remainder 1
So the integer part in binary is 10. For the fractional part, we can multiply it by 2 repeatedly until we reach 1 or until we have 23 bits after the decimal point. Doing so, we get:
0.40625 × 2 = 0.8125, integer part is 0
0.8125 × 2 = 1.625, integer part is 1
0.625 × 2 = 1.25, integer part is 1
0.25 × 2 = 0.5, integer part is 0
0.5 × 2 = 1.0, integer part is 1
So the fractional part in binary is 01100100... (with 23 bits total). To encode this number in IEEE 754, we need to represent the exponent and mantissa in biased form. The exponent is the position of the most significant bit of the fractional part (counting from the left) minus 1, or -2 in this case. So the biased exponent is -2 + 127 = 125 in decimal, or 01111101 in binary. The mantissa is the fractional part without the leading 1, padded with zeros to 23 bits. So the mantissa in this case is 01100100000000000000000. Putting it all together, we get:
Sign bit: 1 (negative)
Exponent: 01111101 (125 in decimal)
Mantissa: 01100100000000000000000
Therefore, the 32-bit binary encoding for -2.40625 in IEEE 754 is:
1 01111101 01100100000000000000000
Step by step
Solved in 2 steps