What is the fixed-point representation of -0.5?

76 Views Asked by At

Calculate a fixed-point representation for the following numbers from the decimal system, if possible. The fixed-point representation should have three digits before the decimal point and five digits after the decimal point, and should use two's complement. Round sensibly.

1: −4

2: −2.5

I am confused for the following reason. We have talked about both, fixed point representation and two's complement, in the lecture. But we have never talked about them being used together, which this exercise wants.

So I assume that it works like this: the three digits before the decimal point use the two's complement to represent the integer without the decimal points after the comma.

Then we would get: -4 = 100.00000. And -2.5 = 110.10000.

So far, everything OK. But there is a problem with this approach. The two's complement has only one representation of 0. So we can represent numbers like 0, 0.5, 0.25, ... with no problem, but how can we represent numbers like -0.5, -0.25, ...? Numbers in the interval (-1, 0). I don't think that's possible.

So where is my mistake here?

0

There are 0 best solutions below