Introduction to Number Systems

MHS makes use of 4 numbering systems in various areas. The 4 numbering systems are decimal, hexadecimal, octal, and binary. Each number system has a base, which is used to convert it from a set of digits to a numeric value. For example, the digits 316 can be converted to a base-10 number using the formula (3×10²)+(1×10¹)+6, which equals 316. The 3, 1, and 6 come from the digits, and the 10 comes from the base.

The following chart explains the 4 numbering systems used.

System Description
Decimal—Base 10 The digits may be from 0 to 9. For example, in decimal, 150 would be (1×10²)+(5×10¹)+0.
Hexadecimal—Base 16 All decimal digits are used, plus A, B, C, D, E, and F to represent numbers 10 through 15, respectively. For example, in hexadecimal, digits A1F would be (10×16²)+(1×16¹)+15, which equals 2,591. This is commonly called Hex.
Octal—Base 8 Only digits 0 to 7 are used. For example, in octal, digits 524 would be (5×8²)+(2×8¹)+4, which equals 340.
Binary—Base 2 Only digits 0 and 1 are used. For example, in binary, digits 1010 would be (1×2³)+(0×2²)+(1×2¹)+0, which equals 10.

 

Bits and Bytes

A digit of a binary number is called a bit. 8 bits make a byte, which is the smallest data type. Since a byte has 8 bits, its range is from 0 to 255, inclusive. See Data Types for more information.

 

Entering Numbers

Some edit boxes in MHS allow both decimal and hexadecimal input. In cases where both types of numbers are allowed, you must prefix a number with 0x to indicate it is hexadecimal.

In some cases, only hexadecimal numbers are allowed, and in those cases it is not required (and sometimes forbidden) to use the 0x prefix.

Copyright © 2006 Shawn (L. Spiro) Wilcoxen