Sistem Digital : Sistem Bilangan II ( Representasi Bilangan Biner Negatif, Hukum Two's Complement, dan Hukum Overflow )
Integer
In the binary number system arbitrary numbers can be represented with :
- The digits zero and one
- The minus sign (for negative numbers)
- The period, or radix point (for numbers with a fractional component)
For purposes of computer storage and processing we do not have the benefit of special symbols for the minus sign and radix point. Only binary digits (0,1) may be used to represent numbers.
Sign-Magnitude Representation
Contoh :
+18 = 00010010
-18 = 10010010
Representasi 0
+0 = 00000000
-0 = 10000000
Two's Complement Representation
Uses the most significant bit as a sign bit. It differs from sign-magnitude representation in the way that the other bits are interpreted.
Complements of Binary Numbers
- 1’s complements
- 2’s complements
1’s complement
Change all 1s to 0s and all 0s to 1s
2’s complement
Find 1’s complement and then add 1
Alternative Representations for 4-Bit Integers
Range Extension
This procedure will not work for twos complement negative integers
- Rule is to move the sign bit to the new leftmost position and fill in with copies of the sign bit
- For positive numbers, fill in with zeros, and for negative numbers, fill in with ones
- This is called sign extension
Negation
Twos complement operation
Take the Boolean complement of each bit of the integer (including the sign bit)
Treating the result as an unsigned binary integer, add 1. The negative of the negative of that number is itself :
Negation Special Case 1
Negation Special Case 2
Addition
OVERFLOW RULE
If two numbers are added, and they are both positive or both negative, then overflow occurs if and only if the result has the opposite sign.
SUBTRACTION RULE
To subtract one number (subtrahend) from another (minuend), take the twos complement (negation) of the subtrahend and add it to the minuend.
Subtraction
Geometric Depiction of Twos Complement Integers
Multiplication Unsigned Binary Integers
Twos Complement Multiplication
Comparison
Sumber
Slide AOK : Representasi Bilangan
Posting Komentar