convert A=12.5(Decimal) and B=1.6(hexadecimal) into binary format and perform following operation

Thread Starter

jeoboo

Joined Apr 8, 2017
5
convert A=12.5(Decimal) and B=1.6(hexadecimal) into binary format employing 6 bits for the integer part and 3 for the fractional part, including the sign bit. Perform following operation
1)C=-A-B (using signed 1's complement)
2)D=-A+B(using signed 2's complement)
3)A-B(using 9's complement)



that is what i've tried
1)i convert A and B into binary, which are A=001100.100,B=000001.011.
-A-B=+(-A)+(-B)
1's complement of A is 110011.011, and 1's complement of B is 111110.100
and then 110011.011+111110.100=1110001.111(carry 1 ), so 110001.111+1=110010.111

2)-A+B=+(-A)+B
2's complement of A is 110100.011
so 110100.011+000001.011=110101.110

i don't know if these are correct or not, thanks for help

also how do i do the number 3, with 9's complement
 

WBahn

Joined Mar 31, 2012
30,045
So how might you determine if 110010.111 is the correct answer? What value does it represent in decimal? What value is C in decimal given the values for A and B? Do they agree?

You might consider whether, in general, you can add two 1's complement numbers the same way you add two unsigned binary numbers?

Hint: What are the 4-bit 1's complement representations for 5 and -5? What happens if you add them?

This gets at the very heart of why we use two's complement.

The term "9's complement" is technically incomplete. Is it in base 9 or base 10. It's almost certainly base-10, in which case it is actually base-10 diminished-radix complement. You might look that up.
 

Thread Starter

jeoboo

Joined Apr 8, 2017
5
i got it. but i am still confused about number 1. after 1's complement, A becomes 110011.011 and B becomes 111110.100, and then add them, so i got 1110001.111, but i have no idea how to get the correct answer.

i try to convert A and B into decimal and then convert to binary to check my answer.
A=12.5(decimal)
B=1.375(decimal)
-A-B=-13.875(decimal)
and then i convert -13.875 into binary, which is -1101.111(this is correct answer)
and i try to use 2's complement to solve it, i can also get the correct answer.

the problem is how to do it with 1's complement....please help me !!
 

Thread Starter

jeoboo

Joined Apr 8, 2017
5
So how might you determine if 110010.111 is the correct answer? What value does it represent in decimal? What value is C in decimal given the values for A and B? Do they agree?

You might consider whether, in general, you can add two 1's complement numbers the same way you add two unsigned binary numbers?

Hint: What are the 4-bit 1's complement representations for 5 and -5? What happens if you add them?

This gets at the very heart of why we use two's complement.

The term "9's complement" is technically incomplete. Is it in base 9 or base 10. It's almost certainly base-10, in which case it is actually base-10 diminished-radix complement. You might look that up.
i tried, but..
 

WBahn

Joined Mar 31, 2012
30,045
i got it. but i am still confused about number 1. after 1's complement, A becomes 110011.011 and B becomes 111110.100, and then add them, so i got 1110001.111, but i have no idea how to get the correct answer.

i try to convert A and B into decimal and then convert to binary to check my answer.
A=12.5(decimal)
B=1.375(decimal)
-A-B=-13.875(decimal)
and then i convert -13.875 into binary, which is -1101.111(this is correct answer)
and i try to use 2's complement to solve it, i can also get the correct answer.

the problem is how to do it with 1's complement....please help me !!
Go back to what 1's complement and 2's complement are.

For an n-bit 2's complement number, the representation for -x is (2^n - x).

For an n-bit 1's complement number, the representation for -1 x is [(2^n-1) - x].
 
Top