Hi there,

I was just wondering if anyone knows of a good resource or tutorial regarding computer arithmetic. I'm having trouble grasping the following:

``````Assume an 8-bit binary number \$9C (in hexadecimal format) is stored in a computer. What decimal value does this number represent, assuming that it is:

(i) An unsigned binary integer?
(ii)    A signed two’s complement binary integer?
(iii)   A fixed-point number with the 4 most significant bits for integer and the 4 least significant bits for fraction?

(i)   2^7 + 2^4 + 2^3 +2^2 = 156
(ii)  -2&7 + 2^4 + 2^3 +2^2 = -100
(iii)  int = 2^3+1; frac = 2^-1 + 2^-2

(b) Perform the following calculation in 8-bit two’s complement arithmetic:

–64 + 40 = ?

(i) Express each number in the formula as an 8-bit two’s complement number.
(ii)    Perform the calculation and express the result as: (1) an 8-bit two’s complement number, and (2) a hexadecimal number.
(iii)   State the values of the condition code flags N, Z, V, C after the calculation has been performed.

(i)   -64 = 1100 0000, 40 = 0010 1000
(ii) 1100 0000 + 0010 1000 = 1110 1000 = \$E8
(iii) NZVC = 1000
``````

I know the answers are provided but if anyone could link me to some resources explaining how this is calculated etc then that would be greatly appreciated.

Useful articles:

For an x86 machine:

Your mileage may vary on that last one; depends on the processor architecture.

Thanks, was looking for something that puts the conversions into simpler terms

How simple are you looking for? Also, have you tried to perform any of the conversions yourself yet?