# Exercise 4.1 Rounding Methods(1)

The excercise :
The following exercise will handle binary (Radix 2) fixed-point numbers.
Should numbers not fit (i.e. too many decimal places) 'Round To Nearest Even' should be used.
b) Encode 2.544921875 as a binary fixed point number with 5 decimal places.

I`m not really sure how to convert it into a fixpoint number,
My approch:

2.544921875 * 25  = 81,4375 and then I have rounded the number to the nearest even : 82 and converted it back to binary 01010010. But the auto correction said the answer is wrong.
Should I round to
81,438? When yes how do I represent that number in binary

After scaling up by 25 we are left with the remainder 0.4375. It is less than 0.5 so we round down. If it was more than 0.5 we would round up. "To nearest even" only comes into play if we have exactly 0.5. This is why it's called a tie-breaking rule (0.5 is a tie between up and down).

by (2.4k points)
I have a similar question. My number is 7.8125 and 3 decimal places are requested. So I multiplied my number with 2^3 and got 62.5 so since its 0.5 I rounded ot nearest even which is 62. That as a B-complement is <>2 but the system says is wrong.
Your reasoning for 62 is correct. But 62 is not <>2 in 2-complement. That would be <>2. And <>2 for -62.

Furthermore the exercise does not ask for complement numbers. It is possible to use complement numbers for fixpoint numbers, but we don't need that here. So you can encode 62 simply as a radix-2 number.
I just realised I converted 64 instead of 62, my bad I guess. Thank you for your explanation!

+1 vote