Binary numeral system: Difference between revisions
imported>Catherine Woodgold (Rewording to adjust after Anthony Argyriou's rearrangement, and misc. minor changes) |
mNo edit summary |
||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
The '''binary number system''', also referred to as base-2, or [[radix]]-2, represents [[number]]s using only the [[digit]]s 0 and 1. This is in contrast with the more familiar [[decimal | {{subpages}} | ||
The '''binary number system''', also referred to as base-2, or [[radix]]-2, represents [[number]]s using only the [[digit]]s 0 and 1. This is in contrast with the more familiar [[decimal numeral system]] (a.k.a. base-10, [[radix]]-10) which uses the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. In the binary system, each digit position represents a power of two. The numeral "<math>10</math>" in binary represents the value consisting of one set of twos (<math>2^1</math>) and no sets of ones (<math>2^0</math>), which we are accustomed to seeing represented as "2". This is analogous to the decimal system, where each digit position represents a [[power of]] ten: the numeral "<math>10</math>", for example, represents the value consisting of one set of tens (<math>10^1</math>), and no sets of ones (<math>10^0</math>). When the numeral system used for a number is in question, one can write the radix as a subscript to the number, as is done in the following table: | |||
<table cellpadding="3" cellspacing="0" border="1"> | <table cellpadding="3" cellspacing="0" border="1"> | ||
Line 13: | Line 15: | ||
==Binary arithmetic== | ==Binary arithmetic== | ||
Arithmetic with binary | Arithmetic with binary numerals is similar to arithmetic with decimal numerals, except that the addition and multiplication tables are much simpler: | ||
<table cellpadding="10" border="0"> | <table cellpadding="10" border="0"> | ||
<tr><td> | <tr><td> | ||
Line 29: | Line 31: | ||
</td></tr></table> | </td></tr></table> | ||
Division and subtraction are performed in the same way as for decimal | Division and subtraction are performed in the same way as for decimal numerals, but using the corresponding rules for binary addition and multiplication. Non-integer quantities can be represented as binary digits to the right of the binary point. For example, <math>3/16 = 0.1875_{10} = 0.0011_2 = (0 \times 2^0)+(0 \times 2^{-1})+(0 \times 2^{-2})+(1 \times 2^{-3})+(1 \times 2^{-4})</math> | ||
Repeating binary expansions also occur, for any fraction where the denominator is not a power of 2. For example, <math>1/5 = 0.001100110011_2</math> (with 0011 repeating). | Repeating binary expansions also occur, for any fraction where the denominator is not a power of 2. For example, <math>1/5 = 0.001100110011_2</math> (with 0011 repeating). | ||
Line 36: | Line 38: | ||
==Use in computing== | ==Use in computing== | ||
The binary system is used | The binary system is used in most electronic computers, as the values of 0 and 1 can be easily represented by a low and a high voltage in a circuit (i.e., by an "on/off" switch). A single digit of a binary numeral is referred to as a [[bit (computing)|bit]], short for '''''bi'''nary digi'''t'''''. (The term ''bit'' was coined in 1947 at [[Bell Laboratories]].) A bit can be a measure of data size, or a measure of [[information entropy]], which are often not equal in size. | ||
===Other representations=== | ===Other representations=== | ||
Because the number of digits in the binary representation of a value can grow quickly, when human readability is desired | Because the number of digits in the binary representation of a value can grow quickly, when human readability is desired binary values are often represented in the [[octal numeral system]] (base 8) or the [[hexadecimal numeral system]] (base 16). Octal uses the digits 0 through 7, while hexadecimal uses the digits 0 through 9, followed by the letters A through F to represent the values ten, eleven, twelve, thirteen, fourteen, and fifteen. | ||
Binary | Binary numerals can be converted to octal by grouping the binary digits in groups of three beginning at the ones place, with each group of three binary digits converting to a single octal digit. Similarly, binary numerals can be converted to hexadecimal by grouping the binary digits in groups of four beginning at the ones place, with each group of four binary digits converting to a single hexadecimal digit. | ||
<table cellpadding="3" cellspacing="0" border="1"> | <table cellpadding="3" cellspacing="0" border="1"> | ||
Line 201: | Line 203: | ||
<td valign="top" align="right">63</td> | <td valign="top" align="right">63</td> | ||
</tr> | </tr> | ||
</table> | </table>[[Category:Suggestion Bot Tag]] | ||
[[Category: | |||
Latest revision as of 16:00, 18 July 2024
The binary number system, also referred to as base-2, or radix-2, represents numbers using only the digits 0 and 1. This is in contrast with the more familiar decimal numeral system (a.k.a. base-10, radix-10) which uses the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. In the binary system, each digit position represents a power of two. The numeral "" in binary represents the value consisting of one set of twos () and no sets of ones (), which we are accustomed to seeing represented as "2". This is analogous to the decimal system, where each digit position represents a power of ten: the numeral "", for example, represents the value consisting of one set of tens (), and no sets of ones (). When the numeral system used for a number is in question, one can write the radix as a subscript to the number, as is done in the following table:
Binary | |
---|---|
Decimal |
Binary arithmetic
Arithmetic with binary numerals is similar to arithmetic with decimal numerals, except that the addition and multiplication tables are much simpler:
|
|
Division and subtraction are performed in the same way as for decimal numerals, but using the corresponding rules for binary addition and multiplication. Non-integer quantities can be represented as binary digits to the right of the binary point. For example,
Repeating binary expansions also occur, for any fraction where the denominator is not a power of 2. For example, (with 0011 repeating).
Irrational numbers can also be expressed, and will have irregular distributions of digits. For example,
Use in computing
The binary system is used in most electronic computers, as the values of 0 and 1 can be easily represented by a low and a high voltage in a circuit (i.e., by an "on/off" switch). A single digit of a binary numeral is referred to as a bit, short for binary digit. (The term bit was coined in 1947 at Bell Laboratories.) A bit can be a measure of data size, or a measure of information entropy, which are often not equal in size.
Other representations
Because the number of digits in the binary representation of a value can grow quickly, when human readability is desired binary values are often represented in the octal numeral system (base 8) or the hexadecimal numeral system (base 16). Octal uses the digits 0 through 7, while hexadecimal uses the digits 0 through 9, followed by the letters A through F to represent the values ten, eleven, twelve, thirteen, fourteen, and fifteen.
Binary numerals can be converted to octal by grouping the binary digits in groups of three beginning at the ones place, with each group of three binary digits converting to a single octal digit. Similarly, binary numerals can be converted to hexadecimal by grouping the binary digits in groups of four beginning at the ones place, with each group of four binary digits converting to a single hexadecimal digit.
Decimal | Binary | Octal | Hexadecimal |
---|---|---|---|
0 | 0 | 0 | 0 |
1 | 1 | 1 | 1 |
2 | 10 | 2 | 2 |
3 | 11 | 3 | 3 |
4 | 100 | 4 | 4 |
5 | 101 | 5 | 5 |
6 | 110 | 6 | 6 |
7 | 111 | 7 | 7 |
8 | 1000 | 10 | 8 |
9 | 1001 | 11 | 9 |
10 | 1010 | 12 | A |
11 | 1011 | 13 | B |
12 | 1100 | 14 | C |
13 | 1101 | 15 | D |
14 | 1110 | 16 | E |
15 | 1111 | 17 | F |
16 | 10000 | 20 | 10 |
17 | 10001 | 21 | 11 |
20 | 10100 | 24 | 14 |
25 | 11001 | 31 | 19 |
32 | 100000 | 40 | 20 |
40 | 101000 | 50 | 28 |
49 | 110001 | 61 | 31 |
63 | 111111 | 77 | 3F |
99 | 1100011 | 143 | 63 |