## Monday, 22 October 2012

### Arithmetic for Computers - 2's Complement Number by Nurul Jamal

2's complement method of representing numbers is commonly used in microprocessor-based equipment. Both positive and negative number must be processed in the microprocessor. The 2's complement representation used for sign and magnitude number can be determined.

Assume a microprocessor have 8 register bits. Figure below show the sign bits or the most significant bit (MSB). If the MSB bit = 0, then the number is positive (+). Otherwise, the number is negative (-). The other 7-bits are represent as the magnitude numbers. The 1st bit from right is the least significant bit (LSB).

Example for converting a negative number. Let's convert 125.

Step 1 : Convert 125 into 8-bits binary number

Step 2 : Each 0 is changed into 1 and each 1 is changed into 0. (Except for MSB)
Step 3 : Add +1 to the first complement. (Don't ask why, because this is the formula to change a positive number to a negative number)
Step 4 : The MSB will be changed into 1.

Easy right?? Okay, here are some question that you can do by yourself. Have fun learning :)

*Convert the following signed decimal numbers to their 8-bit 2's complement equivalents.
>  +13
> +110
> -25
> -90

Posted by,
Nurul Asyikin Binti Jamalulail (B031210038)