Difference between revisions of "Binary"

m (External Links: removed stub)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Binary stands for [[base numbers|base]] 2. It is commonly used in computing for its relative ease of computation and the ease of using ON - OFF states in computers.
+
Binary stands for [[base numbers|base]] 2. It is commonly used in computing for its relative ease of computation and the ease of using ON - OFF states in computers. Binary is written as a number with two different possible digits: 1 and 0.  
  
  
Line 21: Line 21:
 
| <math>2^7</math>|| 128 || 10000000
 
| <math>2^7</math>|| 128 || 10000000
 
|-}
 
|-}
 +
 
In computers, each [[byte]] usually holds 8 [[bit|bits]], or binary digits. Thus a single byte can hole a value ranging from 0 to 255.
 
In computers, each [[byte]] usually holds 8 [[bit|bits]], or binary digits. Thus a single byte can hole a value ranging from 0 to 255.
  
  
 +
==Converting Binary to Decimal==
 +
 +
To convert binary to decimal, take each digit in the binary number which is a 1 and write down the number it represents in decimal.  A good way to know what it represents is to start at the far right of the number (this digit is always 1).  As you move across each digit to the left you double the number it represents in decimal.  Once you've done this, add up all the decimal numbers and the total is your result.  Here is an example:
 +
 +
Binary number 1101 =
 +
 +
1 * 2^0 = 1
 +
 +
0 * 2^1 = 0
 +
 +
1 * 2^2 = 4
 +
 +
1 * 2^3 = 8
 +
 +
Add them all together and you get 13.
  
 +
(Hint:  If the far right digit is a 1 then the result should be an odd number, if it is a 0 then it should be an even number.  This is because the far right digit is the only one which can be odd, as in any other place the digit will be multiplied by a power of 2 that doesn't equal 1.)
  
 +
Note that this works because the only two possible digits are 1 and 0. The digit 0 doesn't yield any additional value to a number, so we only have to consider the 1s.
  
{{stub}}
+
==External Links==
 +
* [http://ryanstutorials.net/binary-tutorial/ Binary Tutorial], An introduction to binary numbers.

Latest revision as of 12:55, 3 September 2019

Binary stands for base 2. It is commonly used in computing for its relative ease of computation and the ease of using ON - OFF states in computers. Binary is written as a number with two different possible digits: 1 and 0.


In computers, each byte usually holds 8 bits, or binary digits. Thus a single byte can hole a value ranging from 0 to 255.

Converting Binary to Decimal

To convert binary to decimal, take each digit in the binary number which is a 1 and write down the number it represents in decimal. A good way to know what it represents is to start at the far right of the number (this digit is always 1). As you move across each digit to the left you double the number it represents in decimal. Once you've done this, add up all the decimal numbers and the total is your result. Here is an example:

Binary number 1101 =

1 * 2^0 = 1

0 * 2^1 = 0

1 * 2^2 = 4

1 * 2^3 = 8

Add them all together and you get 13.

(Hint: If the far right digit is a 1 then the result should be an odd number, if it is a 0 then it should be an even number. This is because the far right digit is the only one which can be odd, as in any other place the digit will be multiplied by a power of 2 that doesn't equal 1.)

Note that this works because the only two possible digits are 1 and 0. The digit 0 doesn't yield any additional value to a number, so we only have to consider the 1s.

External Links

Power of two Number in base 10 Binary representation
$2^1$ 2 10
$2^2$ 4 100
$2^3$ 8 1000
$2^4$ 16 10000
$2^5$ 32 100000
$2^6$ 64 1000000
$2^7$ 128 10000000