Presentation is loading. Please wait.

Presentation is loading. Please wait.

{ Binary “There are 10 types of people in the world: Those who understand binary, and those who don't.”

Similar presentations


Presentation on theme: "{ Binary “There are 10 types of people in the world: Those who understand binary, and those who don't.”"— Presentation transcript:

1 { Binary “There are 10 types of people in the world: Those who understand binary, and those who don't.”

2  Binary is the base-2 numeral system.  We normally use the base-10 system.  The only symbols in binary are “0” and “1”.  “0” represents no electron flow, aka “OFF”.  “1 “ represents electrons flowing, aka “ON”. What is Binary?

3  Each digit in a binary number is a bit.  Eight bits make up a byte. Bits and Bytes

4  Base-10 uses ten as the base of the exponent, while Base-2 uses a two for the base. Base-10 versus Base-2 BASE 10 10 0 = 1 10 1 = 10 10 2 = 100 10 3 = 1000 BASE 2 2 0 = 1 2 1 = 2 2 2 = 4 2 3 = 8

5  Add up all of the place values that hold a “1”. Finding Binary Values Place Values: 8’s, 4’s, 2’s, 1’s 0 1 0 1 = 4 + 1 = 5 1 1 1 0 = 8 + 4 + 2 = 14 0 1 1 1 = 4 + 2 + 1 = 7

6  0 + 1 = 1  1 + 0 = 1  1 + 1 = 10...... carry the left “1”  1 + 1 + 1 = 11... carry the left “1” Adding Binary Numbers 0 1 0 1...... 5 + 0 0 0 1...... +1 ================= 0 1 1 0...... 6

7  An unsigned binary number can only be positive and has all of it’s bits calculated into the size of the value.  A signed binary number can be positive or negative. The left most bit determines the sign. “0” denotes positive, while “1” denotes negative. Unsigned versus Signed Unsigned 0 1 0 1 = 5 1 0 1 0 = 10 1 1 0 1 = 13 Signed 0 1 0 1 = 5 1 0 1 0 = -2 1 1 0 1 = -5

8  Overflow occurs when an unsigned or signed binary number has a carry into a column that doesn’t exist! What is an Overflow? Unsigned 1 1 1 1 = 15 1 1 1 1 = 15 + 0 0 0 1 = + 1 ============ 0 0 0 0 = 0? 0 0 0 0 = 0?

9  There are two zeros: 0000 (+0) and 0000 (-0).  It is possible to have a carry into the “sign bit” by accident, causing errors in math! Problems with Signed 0 1 1 1 = 7 0 1 1 1 = 7 +1 0 1 1 = -3 ============ 0 0 1 0 = 2? Should = 4 0 0 1 0 = 2? Should = 4

10  Flip all of the bits and call that negative!  If you have a carry out from sign bit during addition, do an end-around carry!  This still has two zeroes: 0000 and flipped 1111. One’s Compliment 0 0 0 1 = 1 (flip for negative) 1 1 1 0 = -1 0 1 1 0 = 6 (flip for negative) 1 0 0 1 = -6

11  Flip all of the bits, then add one, call it negative!  Do not do an end-around-carry! Two’s Compliment 0 0 0 = 0flip+1 maps to 0 0 0 0 0 0 = 0flip+1 maps to 0 0 0 0 0 1 = 1flip+1 maps to 1 1 1 0 0 1 = 1flip+1 maps to 1 1 1 0 1 0 = 2flip+1 maps to 1 1 0 0 1 0 = 2flip+1 maps to 1 1 0 0 1 1 = 3flip+1 maps to 1 0 1 0 1 1 = 3flip+1 maps to 1 0 1 1 0 0 = -4given to negative side 1 0 0 = -4given to negative side 1 0 1 = -3from mapped +3 1 0 1 = -3from mapped +3 1 1 0 = -2from mapped +2 1 1 0 = -2from mapped +2 1 1 1 = -1from mapped +1 1 1 1 = -1from mapped +1

12  It depends on:  The NUMBER of digits?  Unsigned or Signed?  Using which complement?  4-bit Unsigned can go from:  0 0 0 0 = “0”  1 1 1 1 = “15”  4-bit Signed in Two’s Compliment can go from:  1 0 0 0 = “-8”  0 1 1 1 = “7” Range of a Binary Number


Download ppt "{ Binary “There are 10 types of people in the world: Those who understand binary, and those who don't.”"

Similar presentations


Ads by Google