Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Systems 1 Fundamentals of Computing Negative Binary.

Similar presentations


Presentation on theme: "Computer Systems 1 Fundamentals of Computing Negative Binary."— Presentation transcript:

1 Computer Systems 1 Fundamentals of Computing Negative Binary

2 Computer Systems 1 (2004 - 2005) Negative Binary How significant are your bits? Binary Addition Rules Sign your name across my CPU Negative Binary  Sign and Magnitude  Two’s Complement

3 Computer Systems 1 (2004 - 2005) Significance of Bits In binary there are two key aspects to a binary number:  MSB = Most Significant Bit  LSB = Least Significant Bit The largest binary value is deemed the most important Sometimes known as “Big-Endian” format E.g.- MSB LSB 10010110

4 Computer Systems 1 (2004 - 2005) Binary Addition Binary addition is a key aspect of working with binary and using negative binary numbers Binary addition rules:  0 + 0 = 0  0 + 1 = 1  1 + 0 = 1  1 + 1 = 10 (0 carry 1)

5 Computer Systems 1 (2004 - 2005) Binary Addition E.g.- 1011 (11) 011010 (26) + 0010 (2) + 110100 (52) = 1101 (13) = 1001110 (78) Binary addition skills are useful when dealing with binary arithmetic / negative numbers / subtraction

6 Computer Systems 1 (2004 - 2005) Negative Binary ‘Normal’ Binary numbers are not indicative of whether the number is positive of negative  Unsigned number Methods of negative number representation in binary have been devised:  Negative binary representation forms Sign and Magnitude Two’s Complement A number which indicates it’s polarity is called a ‘signed number’

7 Computer Systems 1 (2004 - 2005) Sign and Magnitude The MSB is an indicator  A sign bit  The MSB is only a sign, it is NOT part of the actual number  The remaining number is the magnitude Binary 0 = positive number Binary 1 = negative number Numbers are padded out as required

8 Computer Systems 1 (2004 - 2005) Sign and Magnitude E.g-  00000000 = decimal 0  00000001 = decimal 1 (note 0 is postitive)  10000001 = decimal -1 (note 1 is negative)  01010 = decimal 10  11010 = decimal -10  01010011 = decimal 83  11010011 = decimal -83

9 Computer Systems 1 (2004 - 2005) Two’s Complement Binary Uses an implicit sign bit  The sign bit indicates if the number is positive or negative Binary 0 = positive Binary 1 = negative  If the sign bit is set to 1, then the place value of that bit becomes negative when calculating the value The remaining values must then add to the number until it reaches the desired value  The sign bit contributes to the value of the number (the magnitude)

10 Computer Systems 1 (2004 - 2005) Two’s Complement Binary E.g.-  0101 = decimal 5 0 + 4 + 0 + 1  1011 = decimal -5 -8 + 0 + 2 + 1  00100001 = decimal 33 0 + 0 + 32 + 0 + 0 + 0 + 0 + 1  11011111 = decimal -33 -128 + 64 + 0 + 16 + 8 + 4 + 2 + 1

11 Computer Systems 1 (2004 - 2005) Two’s Complement Binary Converting binary to Two’s complement: Take the original binary number and invert it’s values  E.g.- 00001101 (13) 11110010 Then add 1 to the final value  E.g. 11110010 + 1 = 11110011 (-13) Because -128+64+32+16+0+0+2+1=(-13)

12 Computer Systems 1 (2004 - 2005) CS1 What you know now:  Significant bits: MSB LSB  Binary addition  Signed and Unsigned bits  Negative binary Sign and Magnitude  Non-inclusion of significant bit Two’s complement  Inclusion of significant bits  Conversion methods


Download ppt "Computer Systems 1 Fundamentals of Computing Negative Binary."

Similar presentations


Ads by Google