204k views
4 votes
What is the difference between signed and unsigned numbers in binary? Explain 2's complement numbers using a simple example.

User Bmhkim
by
7.2k points

1 Answer

5 votes

Answer:

Signed numbers represent sign like positive or negative for a number. Unsigned numbers don't store any bit for sign

Step-by-step explanation:

Signed numbers are the binary numbers where leftmost digit is used to store the sign and the remaining bits used to store the value (magnitude). if leftmost bit of binary number is 0 it is positive number and if it is 1 then it is a negative number

ex: 00110101 represents (+53)

Here 0 (leftmost) represents sign.

Unsigned number is the number which don't have any sign bit. Here only positive numbers we will represent.

ex:0110101(53)

2's complement: This is used to represent signed numbers. we will get 2's complement by inverting the bits of number and adding 1 to it

0111 1110 for 2's complement first invert the number

1000 0001 after inversion add 1 to it then we will get

010000010

User Konstantin Loginov
by
6.9k points