Reputation: 1
I am new to programming and python. I am struggling to find a consistent way to convert hexadecimal 2's complement to decimal. For example, find the decimal of 0xc001 and 0x7fff.
I have tried (H is the input):
That works with 0xc001 correctly, but doesn't work with 7fff. My control for correct answer is https://www.rapidtables.com/convert/number/hex-to-decimal.html
Example 0xc001:
However, with 7fff:
appreciate a simple answer for beginners :)
thanks.
Upvotes: 0
Views: 659