500 likes | 1.21k Views
Binary System. Common terms might describe file size or memory size: Bit : smallest unit of information Byte : a grouping of eight bits of information K : (kilobyte); 1024 bytes equals 1K of storage. Bits, Bytes. MB : (megabyte); about 1 million bytes of information
E N D
Common terms might describe file size or memory size: Bit: smallest unit of information Byte: a grouping of eight bits of information K: (kilobyte); 1024 bytes equals 1K of storage. Bits, Bytes
MB: (megabyte); about 1 million bytes of information GB: (gigabyte); about 1 billion bytes of information TB: (terabyte); about 1 million megabytes of information Bits, Bytes
Numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, ... Use 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 We know that 5304 =5*103+3*102+0*101+4*100 Base 10 Decimal System
BINARY numbers: 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, .... Written with only 2 digits: "0" and "1" In the same way as for decimal,1011 (binary) = 1*23+0*22+1*21+1*20= 11 (decimal) Base 2 Converting from binary to decimal is simple, just as for 1011 above. Binary System
How to know if 1011 is in binary or in decimal? Subscripts are used to show the base: 10112(binary number), 101110(decimal number) Binary System
Positive Binary Integers Decimal Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 1010 11 1011
Decimal ÷ 2 * 2 Binary
Example 1 Convert Decimal to binary (35)10 = ( … )2 (110001)2 35 ÷2 1 17 ÷2 1 ÷2 8 0 ÷2 4 0 2 ÷2 0 1 ÷2 1 NO
Example 2 Convert Decimal to binary (45)10 = ( … )2 (101101)2 45 ÷2 1 22 ÷2 0 ÷2 11 1 ÷2 5 1 2 ÷2 0 1 ÷2 1 NO
Example 3 Convert Decimal to binary (55)10 = ( … )2 (110111)2 55 ÷2 1 27 ÷2 1 ÷2 13 1 ÷2 6 0 3 ÷2 1 1 ÷2 1 NO
Example 4 Convert Decimal to binary (72)10 = ( … )2 (1001000)2 72 ÷2 0 36 ÷2 0 ÷2 18 0 ÷2 9 1 4 ÷2 0 2 ÷2 0 1 ÷2 1 NO
Example 5 Convert Decimal to binary (85)10 = ( … )2 (1010101)2 85 ÷2 1 42 ÷2 0 ÷2 21 1 ÷2 10 0 5 ÷2 1 2 ÷2 0 1 ÷2 1 NO
Example 6 convert binary to decimal ( 100101)2 = (….)10 1*20+0*21+1*22+0*23+0*24+1*25 = 37
Example 7 convert binary to decimal ( 111101)2 = (….)10 1*20+0*21+1*22+1*23+1*24+1*25 = 61
Example 8 convert binary to decimal ( 111111)2 = (….)10 1*20+1*21+1*22+1*23+1*24+1*25 = 63
Example 9 convert binary to decimal ( 1100000)2 = (….)10 0*20+0*21+0*22+0*23+0*24+1*25+1*22 = 96
Example 10 convert binary to decimal ( 1101001)2 = (….)10 1*20+0*21+0*22+1*23+0*24+1*25+1*22 = 105
Example 11Convert decimal fraction into binary (0.125)10 = ( … )2 .001 integer * 0.125 2 0.250 0 2 0 0.250 0.50 * 2 1 0.50 * 1
Example 12Convert decimal fraction into binary (0.0625)10 = ( … )2 .0001 integer * 0.0625 2 0.1250 0 2 0 0.1250 0.2500 * 2 0 0.2500 * 0.5000 0.5000 1 * 2 1
Example 13Convert decimal fraction into binary (0.03125)10 = ( … )2 .00001 integer * 0.03125 2 0.06250 0 2 0 0.06250 0.12500 * 2 0 0.12500 * 0.25000 0.25000 * 2 0.5000 0 0.5000 * 2 1 1
Example 14convert fraction binary to decimal ( .0001)2 =(….)10 0.0625 0*2-1 + 0*2-2 +0*2-3+ 1*2-4 = 1/16 =0.0625
Example 15 convert fraction binary to decimal ( .0011)2 =(….)10 0.0625 0*2-1 + 0*2-2 +1*2-3+ 1*2-4
Example 16Convert decimal into binary (35.125)10 = ( … )2 100011.001 integer 1 35 2 0.125 *2 0.250 0 1 17 2 0.50 0 0.250 *2 0 2 8 1 1 0.50 *2 0 2 4 0 2 2 1 1 2 .001 NO 100011
Example 17Convert decimal into binary (42.125)10 = ( … )2 101010.001 integer 0 42 2 0.125 *2 0.250 0 1 21 2 0.50 0 0.250 *2 0 2 10 1 1 0.50 *2 1 2 5 0 2 2 1 1 2 .001 NO 101010
Example 18Convert decimal into binary (39.125)10 = ( … )2 100111.001 integer 1 39 2 0.125 *2 0.250 0 1 19 2 0.50 0 0.250 *2 1 2 9 1 1 0.50 *2 0 2 4 0 2 2 1 1 2 .001 NO 101010
Addition 1 + 0 = 1 0 + 1 = 1 0 + 0 = 0 1 + 1 = 0 carry 1
Example 19 1 11000 +1100 100100
Example 20 1 11000 +1 1100 110100
Example 21 1 1 1 1011000 + 111100 10010100
Example 22 1 1 1 100100.000 + 1111101.001 10100001.001
Example 23 1 1 1 1 100101.000 + 1111101.001 11100010.001
Subtraction 1 - 1 = 0 1 - 0 = 1 0 - 0 = 0 0 - 1 = 1 borrow 1
Ex 24 borrow1 11000 - 1100 1100
Ex 25 borrow1 1111101.000 - 100100.001 1011000.111
Ex 26 borrow1 11110 - 1101 10001
Ex 27 borrow1 11111.000 - 110.001 11000.111
Multiplication 1 * 0 = 0 0 * 1 = 0 0 * 0 = 0 1 * 1 = 1
Example 28 11000 *110 00000 11000 11000 10010000
Example 29 11111 *11 11111 11111 1011101
Example 30 1101.1 *110.01 11011 00000 00000 11011 11011 1010000.011
Example 31 11111 *11101 11111 00000 11111 11111 11111 1110000011
Example 32 11.1 *1.11 111 111 111 101.001
Exercises 1- Convert Decimal to binary (25)10 = ( … )2 (80)10 = ( … )2 (59.125)10 = ( … )2 (31.0625)10 = ( … )2 (125)10 = ( … )2
Exercises 2- Convert binary to Decimal (…..)10 = ( 0.01)2 (…..)10 = ( 0.001)2 (…..)10 = ( 0.0001)2 (….)10 = ( 0.1)2
Exercises 3- Convert Decimal to binary (0.125)10 = ( … )2 (0.0625)10 = ( … )2 (0.03125)10 = ( … )2 (0.5)10 = ( … )2
Exercises 4- binary addition 11011 + 111 1111001 + 111111 10001 + 100001 0.1101 + 0.101 0.010001+ 0.0101 + 0.010111
Exercises 5- binary multiplication 11011 * 111 11001 * 11101 1001 * 1001 0.101 * 0.01 0.0111 * 0.0101