4 ms·
A bit late to the party, but here's what I wrote in my JavaScript book: Asides: Number Encoding This may be a bit of a strange concept to discuss in a
by chewxy 12y ago
A bit late to the party, but here's what I wrote in my JavaScript book:
Asides: Number Encoding
This may be a bit of a strange concept to discuss in a book about JavaScript,
but the numbers that we’re all familiar with is only one of many different
kinds of encoding that exsits in the world.
The numerical system that we encode our numbers with today came from ancient
India, and was popularized by the Persians, hence the name Arabic-Hindu numbers.
It is a positional system. For example, the number 15 represents 1 unit in
the tens position, and 5 in the singular position - essentially 1 × 10 + 5 × 1.
Likewise, 314 is 3 × 100 + 1 × 10 + 4 × 1. This is read as 3 units in hundreds
position, 1 unit in the tens position, and 4 units in the singular position
There also exists numerical systems which are non-positoinal. Perhaps
the most famous example are Roman numerals. It’s also positional-ish, since
the position of the numerals are somewhat important for specific cases -
VI and IV mean very different things. The Mayan numeral system is another
example of a non-positional system, intermixed with a unary-ish system.
Most positional numerical systems have somewhat evolved into the same state,
despite having different runes and conventions to represent the same thing.
But perhaps the greatest innovation to numerical systems is the representation
of fractional numbers in a positional numerical system. It allowed us
to do really much fancier mathematics. However, as can be seen in the example
with 1/3 above, representing a fraction in a positional numerical system is
somewhat difficult.
The reason why this section is even here is to function as a reminder to the
reader that binary numerical systems used by modern computers are also
just another system - imagine it to be from another civilization, if you will
- and not be intimidated by it.
Speaking of fractions, the ancient Egyptians were one of the first civilizations
to use a fraction system (the Chinese were the other). Especially by modern day
standards, it was a very interesting fraction system. The fractions used by ancient
Egyptians are expressed only in terms of unit fractions
- i.e. fractions with 1 as the numerator.
There was quite a lot of junk cut out from my book too about ancient chinese numerical systems - they had different numerical systems for different classes of people, and different numerical systems for different bases. And even had negative numbers!
Your question is actually a question of positional and nonpositional notation. I'm quite sure we'll stick with positional notations for some time to come, but uh, you never know about the future. For all we know, there could be a superior nonpositional system out there.