0
\$\begingroup\$

I have two numbers(in decimal):

M = 3892.74
N = 9341.65

I am trying to add and subtract them in binary numbers and then in hexadecimal numbers. I manage to convert the numbers into binary/ hexadecimal with 4 fraction digits.

M = 111100110100.1011 and M = f34.bd70
N = 10010001111101.1010 and N = 247d.a666

and I have found M + N = 13234.51 = 11001110110010.0101 = 33b2.83d6 I am having trouble doing the M - N ? Is there negative numbers in alternate number systems and how would I carry out this subtraction ? If my earlier work can be verified, I would also appreciate it. Thanks

asked Feb 5, 2015 at 0:04
\$\endgroup\$
2
  • \$\begingroup\$ If you're doing this by hand, you can just put a negative sign in front like you normally would with decimal numbers. \$\endgroup\$ Commented Feb 5, 2015 at 3:06
  • \$\begingroup\$ Use binary 2's complement to make one of the numbers negative, then subtract by adding the 2's complement. \$\endgroup\$ Commented Feb 5, 2015 at 4:04

1 Answer 1

1
\$\begingroup\$

M - N can be done in the usual way as:

 00111100110100.1011 - 
 10010001111101.1010 
---------------------
1 10101010110111.0001
---------------------

We have a borrow here. Answer is negative and is in 2's complement form.

Or you can add the 2's complement of N with M.

-N = 2's complement of N = 101101110000010.0110
 0 00111100110100.1011 + 
 1 01101110000010.0110 
 ---------------------
 1 10101010110111.0001
 ---------------------

Take the 2's complement of this number to get -01010101001000.1111 = -5448.9375.

answered Feb 12, 2015 at 18:57
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.