انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية العلوم للبنات
القسم قسم الحاسبات
المرحلة 3
أستاذ المادة نور كاظم ايوب مهدي المهدي
06/11/2015 23:23:24
5.4 discussion hour/Complements In the discussion hour in this week we talk about complement. For each number system, there are two types of complements : b complement and b-1 complement, where b is the base of the system. To find these complement apply the following rules:
Now, how to find bn and bn -1 ?Well to make it easy for you, We explain this rule by the following examples:
5.4.1 1 complement and 2 complement: deep insight!! They are used in digital computers for simplifying the subtraction for logical manipulation. They are useful if we are subtracting a large number from a smaller one. We can find these complements by using Rule1 and Rule2 or we simply do the following: To find 1 complement change each 1 to 0 and each 0 to 1, for example, 1 complement of (10010) is (01101). To find 2 complement, add 1 to 1 complement or start from right and change each 1 to 0 and each 0 to 1 after first 1 in the original number, for previous example, you can directly obtain the 2 complement of (10010) which is (01110) or you can use the traditional (تقليدية) way by performing 01101 + 1 and you have the same result. Practice: Find 1 and 2 complement for the following binary numbers using the two ways explained so far: 1) 1110 2) 10110010 5.4.2 Subtraction by using complements The complements (1and two complements) are important in the subtraction operation, to know how 2-complement is used in implementing subtraction see the following steps:
Let s see the following example: Use 2 complement to execute -11 - 120
Note that (0 1 1 1 1 1 0 1) is the (-131) represented in 2 complement i.e. this is not the binary of 131 which we expect. To see the result from the right corner we must take the 2 complement to this result 0 1 1 1 1 1 0 1 ---- 2 complement ----> 1 0 0 0 0 0 1 1 ? 131 This happened because the result is negative therefore it is represented in 2 complement. Another example: Find the result of -3+5 using 2 complement. +3 ? (011)2 ---- 2 complement ----> 101 5 ? (101)2 101 0 1 0 By discarding the carry the result is (010)2 which equivalent to (2)10 and because the result is positive we don’t need to represent it in 2 complement form.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|