Presentation is loading. Please wait.

Presentation is loading. Please wait.

New Mexico Computer Science for All Author: Ed Angel Title: Bits and Bytes.

Similar presentations


Presentation on theme: "New Mexico Computer Science for All Author: Ed Angel Title: Bits and Bytes."— Presentation transcript:

1 New Mexico Computer Science for All Author: Ed Angel Title: Bits and Bytes

2 Representing Numbers Base 10 integers ▫Whole numbers ▫Ex: 1234, 123, 12, 1 What is its value? Consider abc where each digit is {0,1,…9}

3 Fractional Numbers

4 Base N Numbers “Digits” = {0, 1, …, N -1} Value computes as with base 10 Consider abc.def again

5 Avoiding Ambiguity A number such as 101101 could be in base 2, base 10 or any other base Use subscript if there is any doubt 101101 2 =45 10 Note: when using binary K = 2 10 =1024 and M= 2 20 = 1024 2

6 Binary Arithmetic Same as familiar base 10 arithmetic Example: addition ▫Add bit by bit ▫0+0 =0 ▫1+0 = 0+1 =1 ▫1+1 = 10 101101 +011110 ______ 1001011 carry

7 Question Can you come up with an algorithm for adding two binary numbers? How can you do subtraction of two binary numbers? What about multiplication?


Download ppt "New Mexico Computer Science for All Author: Ed Angel Title: Bits and Bytes."

Similar presentations


Ads by Google