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 What is Binary? 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”.

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

4 Base-10 versus Base-2 BASE 10 100 = 1 101 = 10 102 = 100 103 = 1000
Base-10 uses ten as the base of the exponent, while Base-2 uses a two for the base. BASE 10 100 = 1 101 = 10 102 = 100 103 = 1000 BASE 2 20 = 1 21 = 2 22 = 4 23 = 8

5 Converting Binary Values
Add up all of the place values that hold a “1”. Place Values: 8’s, 4’s, 2’s, 1’s 0101 = = 5 1110 = = 14 0111 = = 7

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

7 What is an Overflow? 1 1 1 1 = 15 + 0 0 0 1 = + 1 ============
Overflow occurs when there is a carry into a column that doesn’t exist! = 15 = + 1 ============ = 0?

8 Unsigned versus Signed
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 = 5 = 10 = 13 Sign&Mag = 5 = -2 = -5

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

10 One’s Compliment 0 0 0 1 = 1 1 1 1 0 = -1 0 1 1 0 = 6 1 0 0 1 = -6
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 1111. = 1 (flip for negative) = -1 = 6 (flip for negative) = -6

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

12 Range of a Binary Number
It depends on: Number of Bits System: Unsigned, Sign&Mag, One’s, Two’s 4-bit Unsigned can go from: = “0” = “15” 4-bit Signed in Two’s Compliment can go from: = “-8” = “7”


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