Binary Arithmetic Binary Addition The four basic rules for adding binary digits (bits) are as follows: 0+0=0 Sum of 0 with a carry 0 0+1=1 Sum of 1 with a carry 0 1+0=1 Sum of 1 with a carry 0 1+1=1 0 Sum of 0 with a carry 1 Examples: 110 6 111 7 1111 15 100 4 011 3 1100 12 _____ _____ _____ _____ _____ ___ 1010 10 1010 10 11011 27
Binary Subtraction The four basic rules for subtracting are as follows: 0-0=0 1-1=0 1-0=1 0-1=1 with a borrow of 1 Examples: 11 3 11 3 101 01 1 10 2 011 _____ _____ _____ _____ _____ 10 2 01 1 010
5 110 6 101101 45 3 101 5 001110 14 _____ _____ _____ _____ _____ 2 001 1 011111 31
1 s and 2 s Complement of Binary Number The 1 s complement and the 2 s complement of binary number are important because they permit the representation of negative numbers. Binary Number 1 0 1 1 0 0 1 0
1 sComplement 0 1 0 0 1 1 0 1 2 s Complement of a binary number is found by adding 1 to the LSB of the 1 s Complement. 2 s Complement= (1 s Complement) +1
Binary number 10110010 1 scomplement 01001101 Add 1 + 1 ---------------------------------------- 2 s complement 01001110
Subtraction Using 2 s complement Method Subtraction is a special case of addition. For example, subtracting +6 (the subtrahend) from +9 (the minuend) is equivalent to adding -6 to +9. Basically, the subtraction operation changes the sign of the subtrahend and adds it to the minuend. The result of a subtraction is called the difference.
The sign of a positive or negative binary number is changed by taking its 2 s Complement.
For example, when you take the 2 s complement of the positive number (00000100)2 (+4), you get (11111100)2.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|