Convert hexadecimal number to bit?

Hi guys, I've been given this assignment and I'm just not sure what to do next. How do I convert it?

The hexadecimal number 0xA1 has the decimal value as

a) 8-bit unsigned:

b) 8-bit signed (2's complement):

c) 16-bit signed (2's complement):

d) 32-bit signed (2's complement):

2 votes, average: 2.00 out of 1 (2 rating, 2 votes, rated)
You need to be a registered member to rate this.
Loading...
Subscribe
Notify of
6 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
ultrarunner
2 years ago

A1 = 1010 0001

  • That would be 161 (from 128+32+1) as 8-bit unsigned decimal.
  • The 8-bit two's complement is 01011111, which corresponds to -95 in decimal.
  • The 16-bit two's complement is 11111111 01011111, which corresponds to -65375 in decimal.
  • The 32-bit two's complement is 11111111 11111111 11111111 01011111, which in decimal form is -4294967135.
ultrarunner
2 years ago
Reply to  drahcir321

In a) I added it anyway.

And for b) to d): Forming a two's complement means inverting all bits and then adding 1. The result can then be converted to the decimal system as usual (ie, adding all place values ​​containing a 1).

ultrarunner
2 years ago

Yes, that's right.

And since the problem says "decimal," you have to convert it.