Ryan
Ryan

Reputation: 153

How do you calculate a decimal number to 8-bit excess binary?

For example I have the number -17. I know that the binary representation of 17 is: 00010001, how would you turn that into an 8-bit excess binary?

Upvotes: 5

Views: 28871

Answers (1)

Jon
Jon

Reputation: 437424

First of all you need to pick a bias for the excess representation. Since it's typical to select a bias equal to half the available range in magnitude, for 8 bits we 'll pick -127 as the bias.

What this means is that you have 8 bits which will be interpreted as an unsigned integer and 127 will be subtracted from that integer to get the final result. Therefore, since we have

final = unsigned + bias
final = -17
bias  = -127

We end up with

unsigned = final - bias = -17 - (-127) = 110

Therefore the excess-127 representation of -17 would be 01101110 (decimal 110).

Upvotes: 4

Related Questions