# Difference between revisions of "Computer Number Systems"

All digital computers – from supercomputers to your smartphone – ultimately can do one thing: detect whether an electrical signal is on or off. That basic information, called a bit (binary digit), has two values: a 1 (or true) when the signal is on, and a 0 (of false) when the signal is off. Larger values can be stored by a group of bits. For example, 3 bits together can take on 8 different values.

Computer scientists use the binary number system (that is, base 2) to represent the values of bits. Proficiency in the binary number system is essential to understanding how numbers and information is represented in a computer. Since binary numbers representing moderate values quickly become rather lengthy, bases eight (octal) and sixteen (hexadecimal) are frequently used as shorthand. In octal, groups of 3 bits form a single octal digit; in hexadecimal, group of 4 bits form a single hex digit.

In this category, we will focus on conversion between binary, octal, decimal, and hexadecimal numbers. There may be some arithmetic in these bases, and occasionally, a number with a fractional part. We will not cover how negative numbers or floating point numbers are represented in binary.

## Resources

Ryan's Tutorials covers this topic in beautifully. Rather than trying to duplicate that work, we'll point you to the different sections:

1. Number Systems - An introduction to what numbers systems are all about, with emphasis on decimal, binary, octal, and hexadecimal. ACSL will typically identify the base of a number using a subscript. For example, $123_8$ is an octal number, whereas $123_{16}$ is a hexadecimal number.
2. Binary Conversions - This section shows how to convert between binary, decimal, hexadecimal and octal numbers. In the Activities section, you can practice converting numbers.
3. Binary Arithmetic - Describes how to perform various arithmetic operations (addition, subtraction, multiplication, and division) with binary numbers. ACSL problems will also cover basic arithmetic in other bases, such as adding and subtracting together 2 hexadecimal numbers. ACSL problems will not cover division in other bases.
4. Negative Numbers - ACSL problems will not cover how negative numbers are represented in binary.
5. Binary Fractions and Floating Point - The first part of this section is relevant to ACSL: fractions in other bases. ACSL will not cover floating point numbers in other basis. So, focus on the section Converting to a Binary Fraction, but keep in mind that ACSL problems may also cover octal and hexadicmal fractions.

The CoolConversion.com online calculator is another online app for practicing conversion from/to decimal, hexadecimal, octal and binary; this tool shows the steps that one goes through in the conversion.

## Format of ACSL Problems

The problems in this category will focus on converting between binary, octal, decimal, and hexadecimal, basic arithmetic of numbers in those bases, and, occasionally, fractions in those bases.

To be successful in this category, you must know the following fact cold:

1. The decimal values of hex digits A, B, C, D, E, F
2. The binary value of hex digits A, B, C, D, E, F
3. Powers of 2, up to 4096
4. Powers of 8, up to 4096
5. Powers of 16, up to 65,536

## Sample Problems

Insert non-formatted text here

### Sample Problem 1

Problem: Solve for $x$ where $x_{16}=3676_8$.

Solution: One method of solution is to convert $3676_8$ into base 10, and then convert that number into base 16 to yield the value of $x$.

An easier solution, less prone to arithmetic mistakes, is to convert from octal (base 8) to hexadecimal (base 16) through the binary (base 2) representation of the number:

\begin{align} 3676_8 &= 011 ~ 110 ~ 111 ~ 110 ~ \text{convert each octal digit into base 2}\cr &= 0111 ~ 1011 ~ 1110 ~ \text{still in base 2, but group by 4 bits, from right-to-left}\cr &= 7 ~ \text{B} ~ \text{E} ~ \text{convert each group of 4 bits into a hexit}\cr \end{align}

## Other Resources

There are many YouTube videos about computer number systems. Here are a handful that cover the topic nicely, without too many ads:

TBD

TBD

TBD