Presentation is loading. Please wait.

Presentation is loading. Please wait.

Binary Arithmetic CPSC 101: Chp 2 John Lamertina.

Similar presentations


Presentation on theme: "Binary Arithmetic CPSC 101: Chp 2 John Lamertina."— Presentation transcript:

1 Binary Arithmetic CPSC 101: Chp 2 John Lamertina

2 Early Need to Count

3 One-to-One Sets 27 pebbles ≡ 27 sheep |||||||||||||||||||||||||||||

4 Counting in 10s Up to TEN More than TEN?

5 Countable Sets of 10 10 10 7

6 Why Decimal Numbers? 10 fingers 10 digits (0,1,2,3,…,9) Countable Sets of 10 Ones Ones Tens Tens Hundreds Hundreds Thousands Thousands etc etc

7 Simple Decimal Number 27 = 20 + 7 = 2 tens + 7 ones = (2×10) + (7×1) = (2×10 1 ) + (7×10 0 ) Powers of 10 Anything to the zero power is 1

8 9327 = 9000 + 300 +20 + 7 = 9 thousands + 3 hundreds + 2 tens + 7 ones = (9×1000) + (3×100) + (2×10) + (7×1) = (9×10 3 ) + (3×10 2 ) + (2×10 1 ) + (7×10 0 ) Another Decimal Number Powers of 10

9 7009 = 7000 + 0 + 0 + 9 = 7 thousands + 0 hundreds + 0 tens + 9 ones = (7×1000) + (0×100) + (0×10) + (9×1) = (7×10 3 ) + (0×10 2 ) + (0×10 1 ) + (9×10 0 ) A Decimal Number with Zeros Powers of 10

10 Decimal vs Binary Decimal numbers are powers of 10 Deci = 10 Binary numbers are powers of 2 Bi = 2

11 Why Binary Numbers? Electronic circuits have two possible states or values: Off and On Off and On: Zero and One (0, 1) Two digits (0, 1): binary number system Thus computers operate on the binary number system

12 Simple Binary Number 101 2 = 100 2 + 0 2 + 1 2 = (1×2 2 ) + (0×2 1 ) + (1×2 0 ) Powers of 2 Read “101, base 2” not 101 squared.

13 Simple Binary Number 101 2 = 100 2 + 0 2 + 1 2 = (1×2 2 ) + (0×2 1 ) + (1×2 0 ) = 4 10 + 0 10 + 1 10 = 5 10 101 2 = 5 10

14 Simple Decimal Number vs Simple Binary Number 15 = 10 + 5 = 1 ten + 5 ones = (1×10) + (5×1) = (1×10 1 ) + (5×10 0 ) 1111 2 = 1000 2 + 100 2 + 10 2 + 1 2 = (1×2 3 ) + (1×2 2 ) + (1×2 1 ) + (1×2 0 ) = 8 10 + 4 10 + 2 10 + 1 10 = 15 10 Powers of 10 Powers of 2

15 Convert Binary to Decimal 10110101 2 (1×2 7 ) + (0×2 6 ) + (1×2 5 ) + (1×2 4 ) + (0×2 3 ) + (1×2 2 ) + (0×2 1 ) + (1×2 0 ) = 128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181 10 Digit10110101 Exponent76543210 Power of 2 27272727 26262626 25252525 24242424 23232323 22222222 21212121 20202020 Decimal1286432168421

16 Convert Decimal to Binary: “Successive Division by Two” Divide by 2 RemainderExplanation 29 29: starting decimal number 14 29/2 = 14, remainder of 1 7 14/2 = 7, remainder of 0 3 7/2= 3, remainder of 1 3/2 = 1, remainder of 1 Binary Result : 11101 1 1 11 0 29 Example Decimal Number: 29


Download ppt "Binary Arithmetic CPSC 101: Chp 2 John Lamertina."

Similar presentations


Ads by Google