Data representation Flashcards
Types
Signed and unsigned
Types of signed
Signed magnitude, 1’s complement, 2’s complement
Unsigned representation is only used for?
Positive nos.
Range with n digits(unsigned)
0 to 2^n -1
Signed no. representation
Sign bit=0 for +ve no. (+5= 0101 or 00000101)
Sign bit=1 for -ve no. (-5= 1101 or 10000101)
Range with n digits(signed)
-(2^n-1 - 1) to (2^n-1 -1) +0 and -0 has two different representations
1’s complement representation
+ve nos. represented as it is with MSB 0
-ve are represented by flipping bits of +ve representation
+5-00000101
-5-11111010
1’s complement representation w n bits
-(2^n-1 -1) to +(2^n-1 -1)
-0 and +0 present
2’s complement representation
+ve nos. as it is
-ve nos. by adding 1 to 1’s complement