Presentation is loading. Please wait.

Presentation is loading. Please wait.

Number Systems Binary and Hexadecimal. Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school 

Similar presentations


Presentation on theme: "Number Systems Binary and Hexadecimal. Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school "— Presentation transcript:

1 Number Systems Binary and Hexadecimal

2

3 Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school  The only numbers that are able to be represented are 1 and 0  Binary numbers are read right to left (inverse way of reading, normal way of reading numbers)

4 How to read binary numbers  Since binary is base 2, every bit that follows the first number in the sequence represents the previous number raised to the power of 2  So 100011101 = 256+0+0+0+16+8+4+0+1 = 285

5 Another way Repeat Division  Basically divide by 2 a lot  If the quotient has a remainder of 1, write down 1, if not write down 0  Keep dividing until you reach zero  Keep in mind, do not automatically put the remainders in fraction form

6 Example of Repeat Division  117  ÷2 58 remainder 1  ÷2 29 remainder 0  ÷2 14 remainder 1  ÷2 7 remainder 0  ÷2 3 remainder 1  ÷2 1 remainder 1  ÷2 0 remainder 1

7 Two’s complement  On the IB exam they will probably ask you to write a number using two’s complement  Two’s complement is a way to write negative numbers in binary  Basically you take the last number in the sequence (the largest number), and make it negative  You can then create any negative number less than the absolute value of the largest number

8 Example of two’s complement

9 How to write decimal points in binary (Floating Point)  Simply add the decimal, and after the decimal follow the same pattern as you would with numbers greater than 1  Instead of each bit after the decimal being 2 n, it is 2 -n.

10 Example MSB LSB ==

11

12 Adding in Binary  Remember these: 0 + 0 = 0 1 + 0 = 1 0 + 1 = 1 1 + 1 = 10 1 + 1 + 1 = 10 + 1 = 11  In the case of a 10 or 11, “carry the one” one digit to the left, just like in normal (base 10) addition.

13 Examples 1 11 1 11 101 + 1 +11 + 10 =10 =110 =111 1 1 1001010 +1101101 =10110111

14 Subtracting in Binary  Remember these: 0 – 0 = 0 1 – 0 = 1 1 – 1 = 0  0 -1 is a special case. Essentially, it requires you to carry a 1 from the left, just like in normal subtraction.

15 Examples 2 02 002 02 100 1100101 - 10 - 110010 = 10 =0110011

16

17 Base 16 A.K.A. Hexadecimal  Hexadecimal works off a base of 16.  It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen.  In base 10 (normal) numbers, for example, 14 means (1*10) + 4. In Hexadecimal, 1D means (1*16) + D (which is 13), or 29. 0 = 0 1 = 1 2 = 2 3 = 3 4 = 4 5 = 5 6 = 6 7 = 7 8 = 8 9 = 9 A = 10 B = 11 C = 12 D = 13 E = 14 F = 15

18 Some Hexadecimal Examples  F is 15  10 is (1*16) + 0, or 16.  1F is (1*16) + 15, or 31.  FF is (15*16) + 15, or 255.  1FF is (1*16 2 ) + (15*16) + 15, or 511.  etc.

19 Binary/Hexadecimal Conversion Examples Binary Hex 0000 0 1000 8 0001 1 1001 9 0010 2 1010 A 0011 3 1011 B 0100 4 1100 C 0101 5 1101 D 0110 6 1110 E 111 7 1111 F

20

21 How to add hexadecimal  Remember to think in base 16 when doing Hexadecimal Math.  If the value is greater than or equal to 16 you carry a 1 over to the next column, and write down the value you received from the addition minus 16  If the number that you receive from addition is greater than 32, then you subtract 32, write down the value, and carry a two over to the next column  Etc.

22 Examples 11 1 1 12 91A 2F A AF 1F2 +3A +B F +E37 69 16 +FA 1943 1B8

23 Subtraction in Hexadecimal  Subtraction works very similar to subtraction with decimal values  Just remember that if you borrow a 1 from a column to the left, the borrowed 1 is equal to 16 (not 10).

24 Example subtraction F F 18 5 10 10 12 7 12 E 8 11 6 0 0 2 B 8 2 F 9 1 - 3 4 7 A 8 -1 5 9 E B 2 B 8 8 3 6 D 5 A 6


Download ppt "Number Systems Binary and Hexadecimal. Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school "

Similar presentations


Ads by Google