*edit: To clarify, I'm not really asking for the exact answers, but if I'm right or wrong in the method. If I'm wrong, I'd like to know what I'm doing wrong so I can figure out the answer on my own.
I'm having a brain fart and my google-fu is failing me. I'm trying to show the decimal value of each number, given that it's a two's complement, hexadecimal 16bit int. This is supposed to be review, but I'm having trouble remembering all of it. So if I understand this correctly at 3am:
a) 25A7
0010 0101 1010 0111 => 9639
b) 90B3
1001 0000 1011 0011
0110 1111 0100 1100 +1
0110 1111 0100 1101 ?? <- is that right? this doesn't seem right since 37043 is out of the acceptable range. Or is it -28493? I'm having trouble mainly with this one.
c) FF3E
1111 1111 0011 1110
0000 0000 1100 0001 +1
0000 0000 1100 0010 => -194 (is this correct as well?)
d) 7753
0111 0111 0101 0011 => 30547
and then the negative for each hex would be:
a) 25A7
0010 0101 1010 0111
1101 1010 0101 1000 +1
1101 1010 0101 1001 = DA59
b) 90B3
1001 0000 1011 0011
0110 1111 0100 1100 +1
0110 1111 0100 1101 = 6F4D
c) FF3E
1111 1111 0011 1110
0000 0000 1100 0001 +1
0000 0000 1100 0010 = 00C2
d) 7753
0111 0111 0101 0011
1000 1000 1010 1100 +1
1000 1000 1010 1101 = 88AD
Posts
It's got a one set in its highest bit, so it is a negative number. It won't be 37,043 since that is a positive number, so...
Yup.
Looks about right.
If you're on Windows, try using the calc (switch into scientific mode) to double check your answers.