Question

I understand how two's-complement works. I also understand how signed magnitude and one's-complement work, and the advantages that two's-complement has over the other encoding methods.

What I can't figure out, is if I'm asked to convert a signed hex number to dec, e.g. 0xF3C645AC, how do I figure out which encoding method it's using?

Was it helpful?

Solution

You can't.

Those interpretation schemes are not encoded themselves in the data.

Machine don't usually implement two kinds of integer representation on hardware level thoug, so you can safely assume the number is being represented the same way all other integers in the context are.

...in the case it's some exercise/homework, well, interpret for all the possibilities, the teacher will be glad :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top