Difference between revisions of "Binary"

(Added a section on how to convert binary to decimal)
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==
 +
 +
Converting a binary number to decimal is not too difficult.  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.)
  
  
 +
==External Links==
 +
* [http://ryanstutorials.net/binary-tutorial/ Binary Tutorial], An introduction to binary numbers.
  
  
 
{{stub}}
 
{{stub}}

Revision as of 17:40, 31 August 2014

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.


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

Converting a binary number to decimal is not too difficult. 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.)


External Links


This article is a stub. Help us out by expanding it.

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