Number systems. Binary system. Bits and bytes
Modern computers “speak” in a digital language composed of 2 digits. The machine language of modern computers is written in Binary Code. A BIT is short for Binary Digit. İf n = number of digits, the number of potential values 2^(n-1) 1 bit can represent up to 2 values
1 bit = 0, 1 1 bit 1 bit = can represent 4 values 0,1,2,3 3 bits can represent 8 possible values 2^3 = 8 0,1,2,3,4,5,6,7 A single bit can only hold 2 values, but the number of values increases exponentially with every digit you add
2^x10^x 0000 * (2^0)0 0011*(2^0)1 0101*(2^1)+0*(2^0)2 0111*(2^1)+1*(2^0)3 1001*(2^1)+0*(2^0)+0*(2^0)4 1011*(2^1)+0*(2^0)+1*(2^0)5 1101*(2^1)+1*(2^0) )+0*(2^0)6
DecimalBinaryOctalBinaryHexadecimal a b c d e f a e
The binary (base two) numeral system has two possible values, often represented as 0 or 1, for each place-value. In contrast, the decimal (base ten) numeral system has ten possible values (0,1,2,3,4,5,6,7,8, or 9) for each place-value. To avoid confusion while using different numeral systems, the base of each individual number may be specified by writing it as a subscript of the number. For example, the binary number may be specified as "base two" by writing it as The decimal number 156 may be written as and read as "one hundred fifty-six, base ten". Base 2 Numbering System
Computers recognize and process data using the binary, or base 2, numbering system. The binary numbering system uses only two symbols (0 and 1) instead of the ten symbols in the decimal numbering system. The position, or place, of each digit represents the number 2 (the base number) raised to the power (exponent), based on its position. Examples 2º = 1 2¹ = 2 2² = 4 2³ = = = = = 128
1 BYTE = 8 Bit 1 Bit can represent 0 or 1. 1 BYTE 1 character 1024 BYTE = 1 KiloByte (KiloByte = KB) 1024 KB = 1 MegaByte (MegaByte = MB) 1024 MB = 1 GigaByte (GigaByte = GB) 1024 GB = 1 TeraByte (TeraByte = TB) You might hear an advertisement that says, "This computer has a 32-bit Pentium processor with 64 megabytes of RAM and 2.1 gigabytes of hard disk space"
Converting From Binary to Decimal Numbers The positional value concept is simple: With both binary and decimal numbers, the actual value of each digit depends on its position (how "far to the left") within the number. For example, in the decimal number 124, the digit '4' represents the value "four," but the digit '2' represents the value "twenty," not "two." The '2' represents a larger value than the '4' in this case because it lies further to the left in the number. Likewise in the binary number , the rightmost '1' represents the value "one," but the leftmost '1' represents a much higher value ("sixty-four" in this case). In mathematics, the base of the numbering system determines how much to value digits by position. For base-ten decimal numbers, multiply each digit on the left by a progressive factor of 10 to calculate its value. For base-two binary numbers, multiply each digit on the left by a progressive factor of 2. Calculations always work from right to left.
In the above example, the decimal number 123 works out to: 3 + (10 * 2) + (10*10 * 1) = 123 and the binary number converts to decimal as: 1 + (2 * 1) + (2*2 * 0) + (4*2 * 1) + (8*2 * 1)+ (16*2 * 1) + (32*2 * 1) = 123 Therefore, the binary number is equal to the decimal number 123.
Converting From Decimal to Binary Numbers To convert numbers in the opposite direction, from decimal to binary, requires successive division rather than progressive multiplication. To manually convert from a decimal to a binary number, start with the decimal number and begin dividing by the binary number base (base "two"). For each step the division results in a remainder of 1, use '1' in that position of the binary number. When the division results in a remainder of 0 instead, use '0' in that position. Stop when the division results in a value of 0. The resulting binary numbers are ordered from right to left.
For example, the decimal number 109 converts to binary as follows: 109 / 2 = 54 remainder 1 54 / 2 = 27 remainder 0 27 / 2 = 13 remainder 1 13 / 2 = 6 remainder 1 6 / 2 = 3 remainder 0 3 / 2 = 1 remainder 1 1 / 2 = 0 remainder 1 Therefore the decimal number 109 equals the binary number
In the example below, the decimal number, 253, is converted into a binary number with a remainder, r, by successive division by 2. The binary number for 253 is /2 = 126 r 1 126/2 = 63 r 0 63/2 = 31 r 1 31/2 = 15 r 1 15/2 = 7 r 1 7/2 = 3 r 1 3/2 = 1 r 1 1/2 = 0 r 1
Procedure to Converting a Decimal Number to a Binary Number There are about five steps involved in converting the number 35 to a binary number. 1. First you need to determine the greater power of 2 that is less than or equal to 35. So, starting with the largest number, 2 to the 5 (32) is smaller than 35. Place a "1" in that column and, then, calculate how much is left over by subtracting 32 from 35. The result is Next, you'll want to check to see if 16 (the next lower power of 2) that fits into 3. Because it does not, an "0" is placed in that column. The value of the next number is 8, which is larger than 3, so an "0" is placed in that column too. 3. The next value that we'll work with is 4, which is still larger than 3. So, again, we'll make this a "0." 4. Okay, our next value will be 2, which is smaller than 3. And, because it is, we'll place a "1" into the column. Now, you'll need to subtract 2 from 3, and the result will be The value of the last number is 1, which still works with the remaining number. Therefore, we'll place a "1" in the last column. Now we see that the binary number for the decimal number 35 is
Example 1 Decimal to Binary Conversion
Example 2 Decimal to Binary Conversion