2,752 views
0 votes
0 votes
Q1.   Find 1's and 2's complement of decimal number of 15

Q2.   Find 1's and 2's complement of decimal number of -15

Answer with Explanation will be welcomed. :)

2 Answers

1 votes
1 votes
Let us take binary values of those decimal number first so 15 require 4 bits in the binary representation but 4 bit are not sufficient for 2's complement representation because in 4 bit we can only represent from -7 to +8 so we will take 5 bits to represent

 

now 15 in binary = 01111

+15 in 2's complement = +15 in binary

-15 in 2's complement = invert bits of +15 and add 1 so

+15 = 01111 inverting it will be 10000 adding 1 it will be 10001

thus +15 = 01111 and -15 = 10001 in 2's complement
1 votes
1 votes

let take n bit binary number.... and the ranges are

signed magnitude :           -(2n-1-1) to + (2n-1-1)

1's complement form :     -(2n-1-1) to + (2n-1-1)

2's complement form :     -(2n-1) to + (2n-1-1)

conclusion :-

for positive numbers, no.of digits required to represent are same in three formats. and one graterthan the normal unsigned representation.

for negative numbers, the number of digits some times (not always) vary wrt to 2's complement form and remaing (1's complement,signed magnitude)  forms. 

positive no. are same in every form i.e., 1's complement form, 2's complement form and sign magnitude form representation is same as normal unsigned binary number  

therefore

unsigned 15 = 1111

signed magnitude 15 =01111

1's complement 15 = 01111

2's complement 15 = 01111

coming to negative numbers....

signed magnitude :- just change the signed bit to 1 for positive signed magntitude representation

1's complement :- just complement the positive 1's complement representation

2's complement :- just 2'complement the positive 2's complement representation

therefore

signed magnitude -15 = 11111

1's complement form of -15 = complement(01111)=10000

2's complement form of -15 =  2's complement(01111)=10001


For justifying my statement " for negative numbers, the number of digits some times (not always) vary wrt to 2's complement form and remaing (1's complement,signed magnitude)  forms "

-16 in three formats are

formula for signed magnitude format is ⌈ log2(no+1)  ⌉+1

sign magnitude format requires 6 bits  and representation is 110000

formula for signed magnitude format is ⌈ log2(no+1)  ⌉+1

 1's complement format requires 6 bits and representation is 101111

but formula for signed magnitude format is ⌈ log2(no)  ⌉+1

2's complement format requires 5 bits only  and representation is 10000


NOTE :-  Don't confuse with 1's complement of a number and 1's complement representation of number

let take no.of digits is 5

1's complement of decimal 15 =  1's complement ( 01111 ) = 10000

1's complement form representation of decimal 15 = 01111

Related questions

0 votes
0 votes
1 answer
2
dvlken asked Oct 16, 2023
345 views
2. Simplify the following Boolean expressions to a minimum number of literals: (a + b + c’)(a’b’ + c) 3. Draw logic diagrams of the circuits that implement the orig...
0 votes
0 votes
0 answers
3
rd8794 asked Nov 21, 2022
415 views
I’m taking for an example kmaps for 3 var A’B’A’BABAB’C’ 0132C4576(probably here we are taking CAB’ = 6and below like AB’C =5 ) A’B’A’BABAB’C’...