Difference between revisions of "Number Systems"

From Coder Merlin
Line 6: Line 6:


{{MerlinMultipageExperienceNavBar}}
{{MerlinMultipageExperienceNavBar}}
== Shortcut Conversions ==
Because both the octal and hexadecimal bases contain <math>2^3</math> and <math>2^4</math> possible digits, respectively, and the binary base contains <math>2^1</math> possible digits, we're able to utilize a shortcut when converting between these systems.  Note that each octal digit is comprised of three binary digits and each hexadecimal digit is comprised of four binary digits.  We can therefore establish (and '''memorize''') the following table:
{| class="wikitable"
!Decimal
!Binary
!Octal
!Hexadecimal
|-
|00
|0000
|00
|0
|-
|01
|0001
|01
|1
|-
|02
|0010
|02
|2
|-
|03
|0011
|03
|3
|-
|04
|0100
|04
|4
|-
|05
|0101
|05
|5
|-
|06
|0110
|06
|6
|-
|07
|0111
|07
|7
|-
|08
|1000
|10
|8
|-
|09
|1001
|11
|9
|-
|10
|1010
|12
|A
|-
|11
|1011
|13
|B
|-
|12
|1100
|14
|C
|-
|13
|1101
|15
|D
|-
|14
|1110
|16
|E
|-
|15
|1111
|17
|F
|}
The shortcut is very straight-forward yet a significant time saver and based on the above information.  When converting between binary, octal, and hexadecimal, there's no need to use an intermediate, decimal step. 
=== Binary to Hexadecimal ===
Group the binary number in sets of four digits, from right to left.  Each binary set represents a single hexadecimal digit.  (It's sometimes helpful to pad the final set with zeroes.)  For example, given the number <math>11000111\;\;00100101_{2}</math>, regroup the binary digits in sets of four:<br/>
<math>11000111\;\;00100101_{2}</math><br/>
<math>\color{Orange}1100\color{Blue}0111\;\;\color{Orange}0010\color{Blue}0101\color{Black}_{2}</math><br/>
<math>\color{Orange}1100\;\;\color{Blue}0111\;\;\color{Orange}0010\;\;\color{Blue}0101\color{Black}_{2}</math>.<br/>
Then, use the memorized table to translate each set of four binary digits to a single hexadecimal digit:
{| class="wikitable"
| 1100
| 0111
| 0010
| 0101
|-
| C
| 7 
| 2
| 5
|}
=== Hexadecimal to Binary ===
Simply follow the above procedure in reverse.  Use the memorized table to convert each hexadecimal digit to a set of four binary digits.
=== Binary to Octal ===
Group the binary number in sets of three digits, from right to left.  Each binary set represents a single octal digit.  (It's sometimes helpful to pad the final set with zeroes.)  For example, given the number <math>11000111\;\;00100101_{2}</math>, regroup the binary digits in sets of three:<br/>
<math>11000111\;\;00100101_{2}</math><br/>
<math>\color{Orange}1\color{Blue}100\color{Orange}011\color{Blue}1\;\;00\color{Orange}100\color{Blue}101\color{Black}_{2}</math><br/>
<math>00\color{Orange}1\;\;\color{Blue}100\;\;\color{Orange}011\;\;\color{Blue}100\;\;\color{Orange}100\;\;\color{Blue}101\color{Black}_{2}</math>.<br/>
Then, use the memorized table to translate each set of three binary digits to a single octal digit:
{| class="wikitable"
| 001
| 100
| 011
| 100
| 100
| 101
|-
| 1 
| 4 
| 3 
| 4 
| 4
| 5
|}
=== Octal to Binary ===
Simply follow the above procedure in reverse.  Use the memorized table to convert each octal digit to a set of three binary digits.
=== Octal to Hexadecimal (and vice versa) ===
This requires slightly more work.  Convert the number in the source base to binary, and then convert from binary to the target base.


== Exercises ==
== Exercises ==

Revision as of 09:45, 24 November 2021

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Curriculum[edit]

ExercisesIcon.png
 Coder Merlin™  Computer Science Curriculum Data

Unit: Numbers

Experience Name: Number Systems (W1011)

Next Experience: ()

Knowledge and skills:

  • §10.311 Demonstrate proficiency in the use of positional notation to represent and convert between numbers in the binary, octal, decimal, and hexadecimal systems

Topic areas: Positional notation

Classroom time (average): 60 minutes

Study time (average): 180 minutes

Successful completion requires knowledge: understand positional notation

Successful completion requires skills: ability to use positional notation to represent numbers in the binary, octal, decimal, and hexadecimal systems; ability to convert between representations of numbers in the binary, octal, decimal, and hexadecimal systems

Experience[edit]

This is a multi-page experience, consisting of the following pages. Be sure to visit them all in sequence. A navigation bar at the bottom of each page is available to assist you.


[[Number Systems/Alternative Bases, Number Systems/Conversions from Decimal, Number Systems/Conversions to Decimal, Number Systems/Customs, Number Systems/Formal Representation, Number Systems/Positional Notation, Number Systems/Shortcut Conversions<ul><li>"]]" is not a number.</li> <!--br--><li>Some use of "" in your query was not closed by a matching "".</li></ul>|« Prior]]Number Systems : 1 of 7Next »


Exercises[edit]

Template:W1011-Exercises



References[edit]


Experience Metadata

Experience ID W1011
Next experience ID
Unit Numbers
Knowledge and skills §10.311
Topic areas Positional notation
Classroom time 60 minutes
Study time 3 hours180 minutes <br />
Acquired knowledge understand positional notation
Acquired skill ability to use positional notation to represent numbers in the binary, octal, decimal, and hexadecimal systems
ability to convert between representations of numbers in the binary, octal, decimal, and hexadecimal systems
Additional categories