Binary Representation of Integers
Binary Representation of Integers Binary number can be represented only by using 0’s and 1’s , but cannot use the sign (-) to denote the negative number or sign (+) to denote the positive number. So, it must be either 0 or 1. There are three methods to represent binary number. They are 1. Sign and magnitude method 2. One’s complement method 3. Two’s complement method · Sign and magnitude method In this method, first bit is considered as a sign bit. Here positive number starts with 0 and negative number starts with 1 . Example: 25 25/2 = 12 1 12/2 = 6 0 6/2 = 3 0 3/2 = 1 1 1/2 = 0 1 So the binary number is (11001) 2 . If we take the size of the word is 1 byte , then the number 25 will be represented as 00011001. Suppose, if the number is -25 , and then it will be represented as 10011001. · One’s Complement Method In this method, the positive nu