BINARY ARITHMETICBinary arithmetic is essential in all digital computers and in many other types of digital systems.
Binary AdditionThe four basic rules for adding binary digits are as follows:		0 + 0 = 0 		Sum of 0 with a carry of 0	0 + 1 = 1		Sum of 1 with a carry of 01 + 0 = 1		Sum of 1 with a carry of 01 + 1 = 10		Sum of 0 with a carry of 1
Examples:Add the following binary numbers11 + 11100 + 10111 + 11110 + 100
Binary subtractionThe four basic rules for subtracting binary digits are as follows:		0 - 0 = 0 		1 - 1 = 0		1 - 0 = 1		      10 - 1 = 10 – 1 with a borrow of 1
ExamplesPerform the following binary subtractions:11 – 0111 – 10110100-11111
Binary MultiplicationThe four basic rules for multiplying binary digits are as follows:		0 x0 = 0 		0 x 1 = 0	1 x 0 = 0	1 x 1 = 1
ExamplesPerform the following binary multiplications:11 x 11101 x 1111001 x 1011
1’s and 2’s complements of binary numbers	The 1’s complement and the 2’s complement of a binary number are important because they permit the representation of negative numbers. The method of 2’s complement arithmetic is commonly used in computers to handle negative numbers.
Obtaining the 1’s complement of a binary number	The 1’s complement of a binary number is found by simply changing all 1s to 0s and all 0s to 1s.Example:0	1	1	1	0	0	1	0   Binary Number	1	0	0	0	1	1	0	1    1’s Complement
Obtaining the 2’s complement of a binary numberThe 2’s complement of a binary number is found by adding 1 to LSB of the 1’s complement.		2’s complement = (1’s complement) + 101110010   	Binary Number 10001101    1’s Complement+                1      add 1    10001110 	2’s Complement
Signed numbersDigital systems, such as the computer must be able to handle both positive and negative numbers. A signed binary number consists of both sign and magnitude information. The sign indicates whether a number is positive or negative and the magnitude is the value of a number. There are three ways in which signed numbers can be represented in binary form: sign-magnitude, 1’s complement, and 2’s complement.
The sign bitThe left most bit in signed binary number is the sign bit, which tell you whether the number is positive or negative. A 0 is for positive, and 1 is for negativeSign - magnitude systemWhen a signed binary number is represented in sign-magnitude, the left most bit is the sign bit and the remaining bits are the magnitude bits.Example	Express the following decimal numbers as an 8-bit number in sign magnitude, 1’s complement and 2’s complement:-39-25-78-55
Arithmetic operations with signed numbersAddition	The two numbers in addition are the addend and the augend. The result is the sum. There are four cases that occur when two signed binary numbers are added.Both numbers are positive Positive number with magnitude larger than negative numbersNegative number with magnitude larger than positive numbersBoth numbers are negative
Examples:	Both numbers are positive  7 + 4 	Positive number with magnitude larger than negative numbers		15 + -6	Negative number with magnitude larger than positive numbers		16 + - 24	Both numbers are negative		-5 + -9
	Perform each of the following subtractions of the signed numbers:	1. 8 – 32. 12 – (-9)3. -25 – (+19)4. -120 – (-30)
divisionWhen two numbers are divided, both numbers must be in true (uncomplemented) form. The basic steps in a division process are as follows:Step 1. 	Determine if the signs of the dividend and divisor are the same or different. 	This determines what the sign of the quotient will be. Initialize the quotient 	to zero.Step 2. 	Subtract the divisor from the dividend using 2’s complement addition to get 	the first partial remainder and add 1 to the quotient. If the partial 	remainder is positive go to step 3. If the partial remainder is zero or 	negative, the division is complete.Step 3. 	Subtract the divisor from the partial remainder and add 1 to the quotient. If 	the result is positive, repeat for the next remainder. If  the result is 	zero or 	negative, the division is complete.Continue to subtract the divisor from the dividend and the partial remainder until there is a zero or negative result.Example: Divide 01100100 by 00011001.
Binary arithmetic

Binary arithmetic

  • 1.
    BINARY ARITHMETICBinary arithmeticis essential in all digital computers and in many other types of digital systems.
  • 2.
    Binary AdditionThe fourbasic rules for adding binary digits are as follows: 0 + 0 = 0 Sum of 0 with a carry of 0 0 + 1 = 1 Sum of 1 with a carry of 01 + 0 = 1 Sum of 1 with a carry of 01 + 1 = 10 Sum of 0 with a carry of 1
  • 3.
    Examples:Add the followingbinary numbers11 + 11100 + 10111 + 11110 + 100
  • 4.
    Binary subtractionThe fourbasic rules for subtracting binary digits are as follows: 0 - 0 = 0 1 - 1 = 0 1 - 0 = 1 10 - 1 = 10 – 1 with a borrow of 1
  • 5.
    ExamplesPerform the followingbinary subtractions:11 – 0111 – 10110100-11111
  • 6.
    Binary MultiplicationThe fourbasic rules for multiplying binary digits are as follows: 0 x0 = 0 0 x 1 = 0 1 x 0 = 0 1 x 1 = 1
  • 7.
    ExamplesPerform the followingbinary multiplications:11 x 11101 x 1111001 x 1011
  • 8.
    1’s and 2’scomplements of binary numbers The 1’s complement and the 2’s complement of a binary number are important because they permit the representation of negative numbers. The method of 2’s complement arithmetic is commonly used in computers to handle negative numbers.
  • 9.
    Obtaining the 1’scomplement of a binary number The 1’s complement of a binary number is found by simply changing all 1s to 0s and all 0s to 1s.Example:0 1 1 1 0 0 1 0 Binary Number 1 0 0 0 1 1 0 1 1’s Complement
  • 10.
    Obtaining the 2’scomplement of a binary numberThe 2’s complement of a binary number is found by adding 1 to LSB of the 1’s complement. 2’s complement = (1’s complement) + 101110010 Binary Number 10001101 1’s Complement+ 1 add 1 10001110 2’s Complement
  • 11.
    Signed numbersDigital systems,such as the computer must be able to handle both positive and negative numbers. A signed binary number consists of both sign and magnitude information. The sign indicates whether a number is positive or negative and the magnitude is the value of a number. There are three ways in which signed numbers can be represented in binary form: sign-magnitude, 1’s complement, and 2’s complement.
  • 12.
    The sign bitTheleft most bit in signed binary number is the sign bit, which tell you whether the number is positive or negative. A 0 is for positive, and 1 is for negativeSign - magnitude systemWhen a signed binary number is represented in sign-magnitude, the left most bit is the sign bit and the remaining bits are the magnitude bits.Example Express the following decimal numbers as an 8-bit number in sign magnitude, 1’s complement and 2’s complement:-39-25-78-55
  • 13.
    Arithmetic operations withsigned numbersAddition The two numbers in addition are the addend and the augend. The result is the sum. There are four cases that occur when two signed binary numbers are added.Both numbers are positive Positive number with magnitude larger than negative numbersNegative number with magnitude larger than positive numbersBoth numbers are negative
  • 14.
    Examples: Both numbers arepositive 7 + 4 Positive number with magnitude larger than negative numbers 15 + -6 Negative number with magnitude larger than positive numbers 16 + - 24 Both numbers are negative -5 + -9
  • 15.
    Perform each ofthe following subtractions of the signed numbers: 1. 8 – 32. 12 – (-9)3. -25 – (+19)4. -120 – (-30)
  • 16.
    divisionWhen two numbersare divided, both numbers must be in true (uncomplemented) form. The basic steps in a division process are as follows:Step 1. Determine if the signs of the dividend and divisor are the same or different. This determines what the sign of the quotient will be. Initialize the quotient to zero.Step 2. Subtract the divisor from the dividend using 2’s complement addition to get the first partial remainder and add 1 to the quotient. If the partial remainder is positive go to step 3. If the partial remainder is zero or negative, the division is complete.Step 3. Subtract the divisor from the partial remainder and add 1 to the quotient. If the result is positive, repeat for the next remainder. If the result is zero or negative, the division is complete.Continue to subtract the divisor from the dividend and the partial remainder until there is a zero or negative result.Example: Divide 01100100 by 00011001.