DEV Community

Cover image for Talking about numbers!
Fernando Vunge
Fernando Vunge

Posted on

Talking about numbers!

We, humans, have been dealing with numbers for quite some time. And when I say "quite some time," I mean thousands of years.

Pre historic numbers

Much later, we created machines to help us deal with those numbers and everything involving them, such as calculations, tasks, work, and so on.
Those sophisticated machines are computers.

First computer

And if computers are going to be our helpers, they need to understand one of the most important things we've ever invented: numbers.

But there's one small problem.

Numbers are abstract concepts. We can't hold them in our hands, nor can we draw them exactly as they are. What we do instead is represent them using symbols. Throughout history, we've used several different systems to write numbers.

Represent all the INFINITE numbers? Awesome!
No! Because a number is not the same thing as its representation.

Look at this:

"3"

That is not the number three.

It's just a symbol, a digit, used to represent the number three.

Likewise, all of these representations refer to exactly the same number:

  • 3
  • três
  • III
  • •••
  • drei

It's like the word "dog." The word doesn't bark, wag its tail, or chase balls; it merely represents a dog. In the same way, the symbol "3" merely represents the number three.

Today, we use only ten digits to write any natural number:

0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

These symbols are known as Indo-Arabic numerals.
Try to guess why they're called that!
I'll give you a hint: the system was developed in India and later spread to the Western world by Arab mathematicians.

first computer

And this is where you ask (or maybe not):

ow can just ten symbols represent an infinite quantity of numbers?

Before answering, it's worth making a small observation.

Throughout this article, I'll mainly talk about natural numbers, the ones we use to count objects:

0, 1, 2, 3, 4...

Real numbers include much more than that. They include, for example:

3,14
-42
√2
π

To represent these numbers, we also need other symbols, such as the minus sign and the decimal separator. But, to keep the explanation simple, we'll stick to natural numbers. Got it?

"But you still didn't answer the damn question."

The answer lies in an extremely simple yet incredibly powerful idea.

That idea is called a numeral system, or simply a base.

In a numeral system, digits can be combined in different positions, and each position changes the value of the digit.

It sounds complicated, but it really isn't.

Take this number:

435

You know this number, right? But notice something.

This number was written using only three of the ten available digits:

4
3
5

Their value doesn't depend only on the symbol itself, but also on the position in which they appear.

In base 10, each position corresponds to a power of ten.

[2] [1] [0]
 4   3   5
Enter fullscreen mode Exit fullscreen mode

The rightmost digit occupies position 0.

The next one occupies position 1.

Then comes position 2, and so on.

Now we simply multiply each digit by the corresponding power of 10 for its position

4 × 10² = 4 × 100 = 400

3 × 10¹ = 3 × 10 = 30

5 × 10⁰ = 5 × 1 = 5

Adding everything together:

400
+30

+5

435

That's why the number represents four hundred and thirty-five, and not "four, three, five."

The position of the digits completely redefines the value of the combination.

I believe you now understand why it's called base 10.

And what about computers?

At the beginning of this article, I said that computers also need to understand numbers.

An apparently simple idea would be to teach them exactly the same numeral system that we use.

They would just need to be able to represent the ten digits, know the value of each one, and learn to combine them the same way we do.

Sounds like a good idea.

But can a machine made only of wires, metal, plastic, and electricity actually do that?

At first glance, it seems challenging — because it is.

Fortunately, there's an extremely clever solution.

It involves changing a few of the things we've just talked about here!

But that is a conversation for Part 2.

Top comments (0)