Reputation: 1143
i'm studying computer science and i can't figure something out of my own.
There is this number : -233
using 10 bit representation
What i need to do is to represent with excess notation the number (2^n-1)
So, i came up with:
1 base 10 = 0000000001
2^10-1 = 1000000000
1 base 10 in my notation = 1000000001
So, my -256 is 0000000001
And my 255 is 1111111110
What is the -233 number following this notation?
The result on the book is 0 1 0 0 0 1 0 1 1 1
My result: 0 0 0 0 0 1 0 1 1 1
Hope you guys can help me.
Upvotes: 0
Views: 3772
Reputation: 1234
I think you were on the right path, but just did a small error.
As I was not familiar with the notation, I had to take a look at it first. It seems like K is usually chosen as 2^(n-1) = 2^9 = 512. Which means 00 0000 0000
= -512 and 11 1111 1111
= 511. I don't know how you get -256, maybe there is your error.
Now, from -512 (00 0000 0000
) to -233 there is a difference of 279 (01 0001 0111
). This seems to be the result of your example.
For easier construction you can do this (assuming K = 2^(n-1)) - example number -12:
00 0000 1100
10 0000 1100
01 1111 0011
01 1111 0100
Upvotes: 1