Binary Values
Apply base 10 principles and practices to base 2
Key Concepts |
|
Terms
Term | Meaning |
---|---|
Binary | Base 2 numbers. |
Decimal | Base 10 numbers. |
Hex or Hexadecimal | Base 16 numbers. |
Place or Place Value | Value of a single number in multi-symbol value. Example: In the number 12345, the Place Value if the 3 is 300. |
Signed | Numbers that represent negative, zero, and positive values. |
Symbols | Written characters used to depict numbers. Symbols represent to represent Decimal are 0,1,2,3,4,5,6,7,8,9. |
Unsigned | Numbers that represent only zero and positive values. |
Introduction
From the Decimal Values section of the text, as well as from your early educational with numbers, you have an intuitive understanding of the Base 10 or Decimal number system. In elementary school you learned counting, Place Value (representing numbers larger that 9), and arithmetic operations (addition, subtractions, etc). You also learned about special situations, such as carrying when adding large numbers ans borrowing when subtracting them
Modern computers are designed to use a different number system...Binary or Base 2...to represent numbers. Base 2 numbers have all the same functions and operations. The processes for Base 2 are the same as for Base 10, but may not be as obvious or intuitive without a little practice
What is Base 2?
Base 2 Number System
Property | Value |
---|---|
# of symbols | 2 |
Symbol Range | 0 - 1 |
Symbols | 0 1 |
Place Value Factor | 2 |
Also referred to as Binary system, Base 2 is a system used by computers to refer to all data, including numbers
The 2 in Base 2 identifies the number of single digit symbols in the system
The largest symbol is Base - 1
1 in Base 2
Converting to Base 10
Using Positional Notation, we can convert a Binary value to Decimal
Each Binary value, based on it's place value, is converted to its Decimal equivalent. The result of all Bit conversions are then summed to product the final Decimal value
Algorithm
Recall that array indexes start at zero(0). Number positions in a number string also start at zero. So the value in the 1st position is said to be in position 0
- Multiply a Binary value by 2 raised to the power if the value's position
- Add the result to the final Decimal result
- Repeat for all Binary values
Order Does Not Matter
You probably noticed that this algorithm does not require *starting with the least- or greatest-significant Binary value
Because we are summing up the result of all the Bit conversions it does not matter the order we perform this algorithm
Ignore Binary Zeros
In this algorithm a Binary value of 0 will result in a Decimal 0 to sum up
Thinking about this, it should be obvious that 0 is any number system base is the same 0. So, in effect we can ignore zeros because they do not have a magnitude
In Logic Circuits we will see this property again. A circuit that outputs 0 volts (or 0 binary value) does not need any circuitry
Converting from Base 10
The algorithm to convert Binary to Decimal is a series of Divide By 2 operations, noting feeing the result into the next cycle. The remainder of each cycle becomes one of the resulting Binary digits
Remainder will Alway be a 0 or 1
It might not be obvious at first look, but dividing a Decimal number by 2 will always yield a remanded of 1 or 0
If the Decimal value is even, dividing by 2 will produce a reminder of 0
If it is odd, then we get a reminder of 1
Using this effect, we can extract each Binary digit from the Decimal value...but backwards. The first remainder we gt is the least-significate Binary value
Algorithm
- Divide the Decimal number by 2
- The reminder becomes the most-significate Binary value
- The result of the division is the new Decimal value to operate upon
- Repeat steps until the result of division is 0
Discrete vs. Analog Values
As computer information changes from voltages in transistors to bits in memory, there is a tiny, but fundamental change in its state. It changes from an analog signal to a discrete state
signal - an analog stream that may fluctuation a small amount and remain valid
Examples:
Dimmer Switch attached to a Light
Water flowing through a hose, controlled by a valve
Speed (velocity) a student drives to class
state - a discrete value that can change between well-defined states
Examples:
Light controlled by an on/off switch
Water Valve being on/off
Student attending a class meeting
Conclusion
The algorithms we use for everyday base 10 conversion still apply, but with a small modification for the different base
The base value (Base 10 or Base 2) indicates how many unique symbols in that system. In base 10 we can count 0 to 9 before running out of symbols. We then create a new place in the number, set it to 1, and start counting from 0 again.
Base 2 follows these same practices, we just run out of symbols faster and have to add place values much more often.