Fundamentals of Computer Programming with C# HTML version

Chapter 8. Numeral Systems
In This Chapter
In this chapter we will take a look at working with different numeral
systems and how numbers are represented in them. We will pay more
attention to how numbers are represented in decimal, binary and
hexadecimal numeral systems, since they are most widely used in
computers and programming. We will also explain the different ways for
encoding numeral data in computers – signed or unsigned integers and the
different types of real numbers.
History in a Nutshell
Different numeral systems have been used since the ancient times. This
claim is supported by the fact that in ancient Egypt people used sun dials,
which measure time with the help of numeral systems. Most historians believe
that ancient Egyptians are the first civilization, which divided the day into
smaller parts. They accomplished this by using the first sun dials, which were
nothing more than a simple pole stuck in the ground, oriented by the length
and direction of the shadow.
Later a better sundial was invented, which looked like the letter T and
divided the time between sunrise and sunset into 12 parts. This proves the
use of the duodecimal system in ancient Egypt, the importance of the number
12 is usually related to the fact that moon cycles in a single year are 12 or the
number of phalanxes found in the fingers of one hand (four in each finger,
excluding the thumb).
In modern times, the decimal system is the most widely spread numeral
system. Maybe this is due to the fact that it enables people to count by using
the fingers on their hands.
Ancient civilizations divided the day into smaller parts by using different
numeral systems – duodecimal and sexagesimal with bases 12 and 60
respectively. Greek astronomers such as Hipparchus used astronomical
approaches, which were earlier used by the Babylonians in Mesopotamia. The
Babylonians did astronomical calculations using the sexagesimal system,
which they had inherited from the Sumerians, who had developed it on their
own around 2000 B.C. It is not known exactly why the number 60 was chosen
for a base of the numeral system but it is important to note that this system
is very appropriate for the representation of fractions, because the number 60
is the smallest number that can be divided by 1, 2, 3, 4, 5, 6, 10, 12, 15, 20
and 30 without a remainder.