1
$\begingroup$

What is 4365 − 3412 when these values represent signed 12-bit octal numbers stored in sign-magnitude format? The result should be written in octal. Show your work.

Octal to binary:

  • 4365: 100 011 110 101
  • 3412: 011 100 001 010

By recognising the role of the sign bit, we can represent positive and negative 64-bit numbers in terms of the bit value times a power of 2. The binary number x, where xi means the ith bit, represents the number:

(x11 * -2^11) + (x10 * 2^10) + (x9 * 2^9) + ... + (x1 * 2^1) + (x0 * 2^0)

I have used the formula given above to convert the value of octal 4365 in decimal:

(1 * -2^11) + (1 * 2^7) + 2^6 + 2^5 + 2^4 + 2^2 + 2^0 = -2048 + 245 = -1803

Similarly, the value of octal 3412 in decimal is 1802.

Having obtained the two values in decimal, I subtract (-1803 - 1802), obtaining the result -3605.

Binary representation of 3605 is 111 000 010 101.

Converting it back to octal gives 7025.


This answer is wrong. It should be octal 7777 or decimal -3777.

The concept is not clear to me. Where am I going wrong?

$\endgroup$

1 Answer 1

1
$\begingroup$

$100 011 110 101$ if is taken as SM in 12bit is $-245$ decimal and $011 100 001 010$ is $1802$ decimal, so we obtain $-245-1802=-2047$. $2047$ in binary is $11111111111$ with $11$ bits so for minus we add one more $1$ to left = $111111111111$. It is octal 7777.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.