Difference between revisions of "CSC103: DT's Notes 1"

From dftwiki3
Jump to: navigation, search
Line 39: Line 39:
 
This section is an overview of the binary system.  Better sources of information can be found on this subject, including [http://courses.cs.vt.edu/csonline/NumberSystems/Lessons/index.html this one] from the University of Vermont.
 
This section is an overview of the binary system.  Better sources of information can be found on this subject, including [http://courses.cs.vt.edu/csonline/NumberSystems/Lessons/index.html this one] from the University of Vermont.
  
To better understand the binary system, we have to refresh our memory about the way our decimal system works.
+
To better understand the binary system, we'll refresh our memory about the way our decimal system works, figure out what rules we use to operate in decimal, and carry them over to binary.
  
First let's count in decimal:
+
First, we'll need to define a new term.  The '''base''' of a system is the number of digits used in the system.  Decimal: base 10: we have 10 digits to write numbers with: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
 +
 
 +
In binary, the base is 2; we have only two digits to write numbers with: 0, and 1.
 +
 
 +
=====Counting in Decimal=====
 +
 
 +
 
 +
Let's now count in decimal and go slowly, figuring out how we come up with the numbers.
 +
 
 +
000
 +
 
 +
That's the first positive number.  Instead of just 1 zero, we pad the number with leading zeros so that the number has 3 digits.  This will help us understand better the rule we're so good at using that we have forgotten it!
 +
 
 +
Let's continue:
  
 
  001
 
  001
Line 53: Line 66:
 
  009  
 
  009  
 
  ----------
 
  ----------
 +
 +
Ok, now an important point in the counting process.  We have written all 10 digits in the right-most position of our number.  Because we could increment this digit, we didn't have to change the digits on the left.  Now that we have reached 9, we need to ''roll over'' the list of digits.  We have to go from 9 back to 0.  Because of this roll-over, we have to ''increment'' (that means adding 1) the digit that is ''directly to the left of the one rolling over.'' 
 +
 
  010
 
  010
 
  011
 
  011

Revision as of 09:45, 31 January 2012

--© D. Thiebaut 08:10, 30 January 2012 (EST)


This section is only visible to computers located at Smith College