Changes

3,356 bytes added ,  21:45, June 1, 2021
m
nobots
Line 1: Line 1: −
The '''binary system''' is a way of representing numbers in base 2, i.e. using only the digits 0 and 1. While it is impractical for [[human]] use, it is the mainstay of [[modern computing]].
+
The '''binary system''' is a way of representing numbers in base 2, i.e. using only the digits 0 and 1. The term 'Binary' means ''composed of two parts'' and comes from the Latin, originally meaning "two by two".  Binary, or base 2, is one of many possible [[Number Systems]].
 +
 
 +
A number written in the system can be denoted by following it with a subscript 2, i.e. <sub>2</sub>. Each digit represents the number of a power of 2 in the complete number, similarly to in the [[decimal system]], where each digit represents the number of a power of 10. The power is defined by the number of digits in the number from right to left through the digit, minus 1, e.g. 100<sub>2</sub>, where the digit 1 is the third digit from the right, and thus represents 2<sup>2</sup>, or 4. While it is generally impractical for [[human]] use, it is the mainstay of modern [[computing]]. A binary system is also used in [[electronics]], which commonly uses '''0''' to mean "no voltage is present" '''1''' to mean "a voltage is present".  Binary notation is used in circumstances in which a thing is in one of two possible conditions and no other condition is possible; the switch is on or the switch is off, the page has data on it or the page has no data.
 +
 
 +
==Operations==
 +
 
 +
===Successor Function===
    
To increment a binary number, follow this rule:
 
To increment a binary number, follow this rule:
   −
1. Current digit is the end digit
+
#Current digit is the end digit
−
2. Change the current digit
+
#Change the current digit
−
3. If current digit = 1
+
# If current digit = 1
−
4. Then:
+
##Then:
−
  4a.Shift current digit to away from the end digit
+
###Shift current digit to away from the end digit
−
  4b.Goto step 2
+
###Go to step 2
−
5: Else:
+
##Else:
−
  5a:You're done.
+
###You're done.
 +
 
 +
===Addition===
 +
 
 +
Binary addition is fairly simple, making for efficient use in computers. To add one bit (digit) binary numbers, use the following table:
 +
{| class="wikitable"
 +
|-
 +
! X
 +
! Y
 +
! X + Y
 +
! Carry
 +
|-
 +
| 0
 +
| 0
 +
| 0
 +
| 0
 +
|-
 +
| 1
 +
| 0
 +
| 1
 +
| 0
 +
|-
 +
| 0
 +
| 1
 +
| 1
 +
| 0
 +
|-
 +
| 1
 +
| 1
 +
| 0
 +
| 1
 +
|-
 +
|}
 +
 
 +
to add a multiple digit number, add the bits (digits) individually using the table, and add the carry if necessary. Consider the following example:
 +
 
 +
  000000110-  Previous Addition's carry
 +
  1000110110  X
 +
  +
 +
  0110001010  Y
 +
-----------------
 +
  1110111000
 +
 
 +
===Subtraction===
 +
Subtraction in binary can be carried out similar to decimal notation, however, there is a more efficient way, which is usually used in computers. Negative numbers a written in "Two's complement notation". In this notation, You "flip" the digits in the binary number and add one. For example,
 +
 
 +
<blockquote>
 +
-10011 = 01100 + 1 = 01101
 +
</blockquote>
 +
 
 +
To do subtraction, you add a number to its complement and ignore the final carry.
 +
 
 +
<blockquote>
 +
5 - 2 = 101 - 010 = 101 + (101 + 1) = 101 + 110 = [1]011 = 011 = 3
 +
</blockquote>
 +
 
 +
Note that this method requires the amount of digits to be fixed.
 +
 
 +
===Multiplication===
 +
Multiplication in binary is far more simple than multiplication in decimal. To multiply two binary numbers X * Y, use the following algorithm:
 +
#set a to 0
 +
#start at the rightmost digit of the X
 +
#for the nth digit (from the right, starting with 0)
 +
##If the digit is zero, continue
 +
##If the digit is one,
 +
###Append n zeros to the end of Y and add this to a
 +
#a is now equal to X * Y
 +
 
 +
For Example:
   −
A more concrete example can be found here:
+
    1010 X *
−
http://woodgears.ca/marbleadd/index.html
+
    1101 Y
 +
----------------
 +
    '''0000'''
 +
    '''1101'''0
 +
  '''0000'''00
 +
  '''1101'''000
 +
---------------
 +
10000010
    +
=First Numbers=
 
The first 16 binary digits:
 
The first 16 binary digits:
 
{|style="text-align:center"
 
{|style="text-align:center"
Line 72: Line 154:  
|}
 
|}
    +
== Boolean operations ==
 +
Because each bit can be considered a true/false value, [[Boolean algebra]] operations are easily done with binary values.  For this reason, they are often referred to as bit-wise operations.  The operations are NOT, AND, OR, NAND, XOR, SHL (shift left), and SHR (shift right) - and variations such as ROL (rotate left) and ROR (rotate right).
 +
 +
==See also==
 +
* [[Binary Code]]
 +
* [[Binary Function]]
 +
* [[Binary Compound]]
 +
 +
== External links ==
 +
*[http://forums.cisco.com/CertCom/game/binary_game_page.htm?site=celc A binary numbering game]
 +
*[http://woodgears.ca/marbleadd/index.html= How to make binary numbers]
 +
 +
{{nobots}}
 
[[Category:Mathematics]]
 
[[Category:Mathematics]]
Block, SkipCaptcha, Upload, Automoderated users, Check users, delete, edit, Moderators, move, oversight, protect, ratelimit-exempt, rollback, Administrators
20,329

edits