Classic Computer Magazine Archive COMPUTE! ISSUE 47 / APRIL 1984 / PAGE 108

Different Number Systems

When programming books mention a memory location, many times they put a $ in front of the number. Why is this done?

Marc Foglia

Humans are accustomed to counting by tens, using decimal (base 10) numbers. Computers count by twos, using binary numbers. But binary numbers, such as 10111010, are not easy to read, so machine language programmers commonly use hexadecimal (base 16) numbers because they are easier to read than binary numbers, and easier to translate into the computer's binary system than are decimal numbers. BASIC programmers, however, stick with ordinary decimal.

Since all three number systems can be used in computer programming, we must be able to differentiate between them. For example, if you see the number 0100, you must know if it means 100 (as a decimal number) or 4 (as a binary number) or 256 (as a hexadecimal number).

To prevent this confusion, programmers commonly identify binary and hexadecimal numbers with special symbols:

%0100 (binary)
$0100 (hexadecimal)
  100 (no symbol for decimal)