1. Suppose we represent non-negative real numbers in fixed point notation fixed<
ID: 3566037 • Letter: 1
Question
1. Suppose we represent non-negative real numbers in fixed point notation fixed<16, 16> where 16-bits are allocated for
the integer part of the number and 16-bits are allocated for the fractional part, i.e., the digits after the decimal point.
What real number would 0x4321_FEDC represent? For full credit explain your answer.
2. What would be the largest real number (in decimal) that could be represented in fixed<16, 16>? For full credit
explain your answer.
3. What would be gap between each fixed point number (in decimal)? For full credit explain your answer.
4. What would be the fixed<16, 16> representation of 40113.975. Use the round to nearest, ties to even rounding mode.
Write your answer as an 8-hexdigit number and for full credit explain your answer.
5. Convert the binary number that was your answer from Exercise 4 back to decimal.
6. What is the absolute value of the roundoff error when 40113.975 is converted to fixed<16, 16> representation. Express
you answer as a power of 10. For full credit explain your answer.
Explanation / Answer
1. 4321_FEDC (hexa) = 0100 0011 0010 0001 _ 1111 1110 1101 1100 (binary)
integer part = 214 + 29 + 28 + 25 + 20 = 17185
fractional part = 2-0 + 2-1 + 2-2 + 2-3 + 2-4 + 2-5 + 2-6 + 2-8 + 2-9 + 2-11 + 2-12 + 2-13 = 0.99554443359375
So the number is 17185.99554443359375
2. Maximum nuber occurs when all the bits in the representation are 1's
So maximum number is 1111111111111111_1111111111111111
It's decimal equivalent(done as in part-1) is 65535.9999847412109375
3. The difference between two successive fixed point numbers is all bits zeroes except the last bit (right most) as 1
So gap (in decimal) = 2-15 = 3.05175 * 10-5
4. The actual binary representation of 40113.975 is 1001110010110001.111110011001100110011001100110011001100110011001 ...... (1001 in fractional part repeats)
But rounding the fractional part to 16 bits we get 1001110010110001.1111100110011001 and it's hexadecimal representation is 9CB1_F999
5. Converting 9CB1_F999 or 1001110010110001.1111100110011001 into decimal just like we did in part-1, we get
40113.9749908447265625
6. Round off error = 40113.975 - 40113.9749908447265625 = 9.1553 * 10-6
NOTE : Use this cool website for easy calculations : http://www.exploringbinary.com/binary-converter
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.