On 2016-08-29 02:44, Ken Kundert wrote:

[snip]

The way the scientific and engineering communities predominately write real
numbers is by using SI scale factors.  These numbers almost always represent
physical quantities, so it is common to write the number with scale factor and
units.  So for example, the distance to Andromeda is 780kpc, the pressure at the
bottom of the Mariana Trench is 108MPa, the total power produced by a typical
hurricane is 600TW, the number of base pairs in human DNA is 3.2Gb, and the Bohr
radius is 53pm.  These numbers are the language of science and engineering, but
in recent years they have also entered the realm of popular culture. For
example, an article by Ars Technica that calculates that the value of the music
that can fit on a classic iPod as over $8G (that is the total penalty that can
be accessed if they were all stolen copyright works).

http://arstechnica.com/tech-policy/2012/06/from-gigabytes-to-petadollars-copyright-math-begets-copyright-currency/

For currency, it's usually "million" or "m"/"M", "billion" or "bn" (or maybe "b"/"B"), "trillion" (or maybe "tn" or "t"/"T"). Using a suffixed SI scale factor with a prefixed currency symbol is not that common, in my experience.

[snip]

When working with a general purpose programming language, the above numbers
become:

    780kpc -> 7.8e+05
    108MPa -> 1.08e+08
    600TW  -> 6e+14
    3.2Gb  -> 3.2e+09
    53pm   -> 5.3e-11
    $8G    -> 8e+09

Notice that the numbers become longer, harder to read, harder to type, harder to
say, and harder to hear.

There's also "engineering notation", where the exponent is a multiple of 3.

[snip]

The same question confronted the developers of Python when it was decided to add
binary, octal and hexadecimal number support to Python. You could have done it
with libraries, but you didn't because binary, octal and hexadecimal numbers
were too common and important to be left as second class citizens. Well, use of
binary, octal and hexadecimal numbers is tiny compared to the use of real
numbers with SI scale factors.

I expect that octal and hexadecimal number support was there from the start. CPython is written in C and Python borrowed the notation. The binary notation was added in Python 2.6 and followed the same pattern as the hexadecimal notation. The octal notation of a leading "0" was later replaced with a clearer one that followed the same pattern.

C had octal and hexadecimal from the start. (Actually, I'm not entirely sure about hexadecimal, octal being the preferred form, but if it wasn't there from the very start, it was an early addition.)

C descends from BCPL, which had octal and hexadecimal, and BCPL dates from 1967.

There are other languages too that had hexadecimal and octal.

They've been around in programming languages for decades.

How many languages have scale factors?

Does Fortran? Not that I know of.

[snip]

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to