Page 1 of 4

Octal number system

Posted: Tue Aug 13, 2019 8:28 pm
by masako
Or number systems in general, other than decimal...

Can anyone explain, or point me in the direction of a good explanation of octal numbers, please?

I'm working on a language and I want it to have an octal numbering system.

Thank you in advance.

Re: Octal number system

Posted: Tue Aug 13, 2019 9:36 pm
by Ryan of Tinellb
What are you having trouble with? It's just like decimal, except you can only count to 7 before needing another digit.

Code: Select all

1, 2, 3, ..., 6, 7, 10, 11, 12, ..., 16, 17, 20, 21, ..., 75, 76, 77, 100, 101....

Code: Select all

563 = 5*(8^2) + 6*(8^1) + 3*(8^0) => 5*64 + 6*8 +  3*0 = 371
Replace the 8s with whatever number you choose to get different bases.

Re: Octal number system

Posted: Tue Aug 13, 2019 9:38 pm
by bradrn
Is it alright if I try to write my own explanation?

So first, let’s have a close look at our own decimal number system. Let’s try counting some numbers:

Code: Select all

  0
  1
  2
  ...
  8
  9
 10  ← return to 0, left digit increases from 0 to 1
 11
 12
  ...
 18
 19
 20  ← return to 0, left digit increases from 1 to 2
 21
 ...
 98
 99
100  ← two returns to 0, leftmost digit increases from 0 to 1
101
...
I’ve skipped a few numbers, but the general pattern is clear enough: the last digit goes from 0 to 9, and when it returns back to 0, the digit just left of it increases. So your right digit counts from 0 to 9, the digit left of it counts how many times the rightmost digit has returned to 0 (i.e. every 10 numbers, it increases by 1), then the digit left of that counts how many times the second digit has returned to 0 (i.e. every 100 numbers, it increases by 1), then the… anyway, you get the idea. We say this system is base-10, since the nth digit from the right increases by 1 for every time the number increases by 10n.

Different bases work the same way. For instance, the binary, or base-2 system, used heavily in computing, has the rightmost digit go from 0 to 1:

Code: Select all

  0
  1
 10
 11
100
101
110
111
Note that these are different to the corresponding numbers in decimal; for instance, 100binary is not the same number as 100decimal! If you count down the chart above, it turns out that 100binary is the fourth binary number, so 100binary = 4decimal

The octal system you are asking about is just base-8. It works in the same way, with digits going from 0 to 7 before returning:

Code: Select all

  0
  1
  2
  3
  4
  5
  6
  7  ← corresponds to decimal 7
 10  ← corresponds to decimal 8
       note rightmost digit has returned to zero,
       digit to the left has increased from 0 to 1
 11
 12
 13
 14
 15
 16
 17  ← corresponds to decimal 15
 20
 21
 22
 23
 24
 25
 26
 27
 30
 ...
 77
100  ← two digits have returned from 7 to 0,
       so leftmost digit increases from 0 to 1
101
...

Re: Octal number system

Posted: Tue Aug 13, 2019 9:48 pm
by Ryan of Tinellb
This video shows a couple of different ways to convert to other bases from decimal. I prefer the second way, repeatedly dividing by the new base, and reading back the remainders in reverse order.

Re: Octal number system

Posted: Tue Aug 13, 2019 9:56 pm
by Ryan of Tinellb
Thanks, bradrn. I really like using other bases, and I tend to rush through explanations of things I'm too familiar with.

Re: Octal number system

Posted: Tue Aug 13, 2019 11:16 pm
by zompist
Getting large numbers right can be tedious, so if you want to skip that, or double-check your results, you can use Wolfram Alpha. E.g. type in

563 base 8

and you'll get 371, plus the number in some other bases, e.g. 26b12. Or type

371 in base 8

to get 5638.

BTW, Northern Pame is a natlang that uses base 8. Some computer languages support base 8-- I think it was an early way to create succinct representations of base 2 numerals.

Re: Octal number system

Posted: Wed Aug 14, 2019 2:10 am
by bradrn
zompist wrote: Tue Aug 13, 2019 11:16 pm BTW, Northern Pame is a natlang that uses base 8.
I didn’t know that any even existed! According to Wikipedia, Yuki also uses octal as well.

Of course, it’s worth noting that many of zompist’s own conlangs use interesting bases as well, including 6, 12 and 18.
Some computer languages support base 8-- I think it was an early way to create succinct representations of base 2 numerals.
According to Wikipedia, early computers used words containing 6, 12, 24 or 36 bits, making octal (with 3 bits per digit) an ideal choice. Of course, today hexadecimal is more popular, with computers having 32- or 64-bit words.

Re: Octal number system

Posted: Wed Aug 14, 2019 7:08 am
by Salmoneus
Can confirm that the big-bright-pictures 1980s "how computer programming works" book I had when I was 5 or 6 assumed that we'd be using octal, although it also covered binary and hexadecimal.

[and now, although computers are everywhere, children are no longer given doring kindersley books on programming...]

----

Anyway, if you think a conlang with octal is a pain, try working with the system one of my concultures uses: a mixed radix where the radices are (most of) the series of the lowest numbers having the series of integers as factors (there must be a more concise mathematical term for that) and radices after the radix point are negative.

It does, however, have some advantages, although sadly I can't remember most of them. Makes expressing fractions easier, though. So something like 6/7, which in decimal is 0.85714285714 is just 1.138 in this system. 1/3, which is 0.333333..... for us is plain 1.8 in this system. And so on.

Re: Octal number system

Posted: Wed Aug 14, 2019 7:22 am
by con quesa
Salmoneus wrote: Wed Aug 14, 2019 7:08 am Can confirm that the big-bright-pictures 1980s "how computer programming works" book I had when I was 5 or 6 assumed that we'd be using octal, although it also covered binary and hexadecimal.

[and now, although computers are everywhere, children are no longer given doring kindersley books on programming...]
Turns out hexadecimal won as the main non-base-10 number representation system used in computing. Although I would say that the main use of hex in programming is for creating bitmasks (convenient because one hex digit is exactly four bits and it's pretty easy to memorize the 16 relevant bit patterns), which is usually not the same thing as counting.

For kids today there are beginner-friendly youtube channels about programming concepts but the principle is the same.

Re: Octal number system

Posted: Wed Aug 14, 2019 7:32 am
by bradrn
Salmoneus wrote: Wed Aug 14, 2019 7:08 am Anyway, if you think a conlang with octal is a pain, try working with the system one of my concultures uses: a mixed radix where the radices are (most of) the series of the lowest numbers having the series of integers as factors (there must be a more concise mathematical term for that) and radices after the radix point are negative.
Sounds interesting! Could you possibly be referring to the factorials? (Or if not, could you give the first few elements of the list of radices, or try looking up the sequence on https://oeis.org/?)

Re: Octal number system

Posted: Wed Aug 14, 2019 9:18 am
by Curlyjimsam
I have languages which historically used one base, and then partially shifted to another after language contact, creating weird hybrid systems.

Re: Octal number system

Posted: Wed Aug 14, 2019 11:38 am
by Travis B.
Probably a big part of why hex won out over octal is that modern computers use eight-bit bytes, which can be neatly represented in hex, whereas systems that used octal commonly had words divisible in size by three bits (e.g. the PDP-10), which octal is more suited for representing.

Re: Octal number system

Posted: Wed Aug 14, 2019 12:40 pm
by KathTheDragon
bradrn wrote: Wed Aug 14, 2019 7:32 am
Salmoneus wrote: Wed Aug 14, 2019 7:08 am Anyway, if you think a conlang with octal is a pain, try working with the system one of my concultures uses: a mixed radix where the radices are (most of) the series of the lowest numbers having the series of integers as factors (there must be a more concise mathematical term for that) and radices after the radix point are negative.
Sounds interesting! Could you possibly be referring to the factorials? (Or if not, could you give the first few elements of the list of radices, or try looking up the sequence on https://oeis.org/?)
This one looks likely

Re: Octal number system

Posted: Wed Aug 14, 2019 1:02 pm
by Vijay
bradrn wrote: Wed Aug 14, 2019 2:10 am
zompist wrote: Tue Aug 13, 2019 11:16 pm BTW, Northern Pame is a natlang that uses base 8.
I didn’t know that any even existed! According to Wikipedia, Yuki also uses octal as well.
Having written a paper for a grad seminar on numeric systems once, I've practically come to believe you can find a natural language somewhere that uses any number system, if it even bothers to use numbers at all. :P

Re: Octal number system

Posted: Wed Aug 14, 2019 6:21 pm
by Salmoneus
KathTheDragon wrote: Wed Aug 14, 2019 12:40 pm
bradrn wrote: Wed Aug 14, 2019 7:32 am
Salmoneus wrote: Wed Aug 14, 2019 7:08 am Anyway, if you think a conlang with octal is a pain, try working with the system one of my concultures uses: a mixed radix where the radices are (most of) the series of the lowest numbers having the series of integers as factors (there must be a more concise mathematical term for that) and radices after the radix point are negative.
Sounds interesting! Could you possibly be referring to the factorials? (Or if not, could you give the first few elements of the list of radices, or try looking up the sequence on https://oeis.org/?)
This one looks likely
Yes, more or less. It's the series of the lowest common multiples of the series of the integers, minus duplicates, and minus the numbers 2, 6, and 420. I.e. 1, 12, 60, 840, 2520, etc.

As that site mentions, in this system all rational numbers can be expressed with a finite number of digits.

Obviously, this is not very feasible in the long run, since beyond a certain point you're dealing with increasingly large bases - the 10th place is base-23 - but since this is a mediaeval culture it's not really a practical issue. Also, I suspect that, like the Greeks, they use letters as numbers, so they can cope easily with large bases.

It may of course seem that this is too insane and sophisticated for any real pre-modern culture to use. However, if you take a base-12 system for counting daily things, and add it to a mathematical base-60 system like that of the Babylonians, you already have the first three radices, after which I extrapolate the local mathematicians extrapolating the series to higher numbers.

Re: Octal number system

Posted: Thu Aug 15, 2019 2:43 am
by TomHChappell
Curlyjimsam wrote: Wed Aug 14, 2019 9:18 am I have languages which historically used one base, and then partially shifted to another after language contact, creating weird hybrid systems.
Didn’t something like that demonstrably happen to several natlangs as well? On several continents, in several millennia?

Re: Octal number system

Posted: Thu Aug 15, 2019 5:10 am
by masako
Thank you everyone. Immensely helpful information, most especially the Wolfram Alpha link.

Re: Octal number system

Posted: Thu Aug 15, 2019 11:41 am
by mèþru
TomHChappell wrote:
Curlyjimsam wrote: Wed Aug 14, 2019 9:18 am I have languages which historically used one base, and then partially shifted to another after language contact, creating weird hybrid systems.
Didn’t something like that demonstrably happen to several natlangs as well? On several continents, in several millennia?
I think it happened with most European languages at least once, some of them more than once.
Vijay wrote:Having written a paper for a grad seminar on numeric systems once, I've practically come to believe you can find a natural language somewhere that uses any number system, if it even bothers to use numbers at all.
Even base nine?

Re: Octal number system

Posted: Thu Aug 15, 2019 12:04 pm
by Richard W
Salmoneus wrote: Wed Aug 14, 2019 6:21 pm Obviously, this is not very feasible in the long run, since beyond a certain point you're dealing with increasingly large bases - the 10th place is base-23 - but since this is a mediaeval culture it's not really a practical issue. Also, I suspect that, like the Greeks, they use letters as numbers, so they can cope easily with large bases.
Letters only defer the problem, and Greek letters were a non-positional decimal notation. Babylonians used the decimal system for their sexagesimal digits, as we still do for minutes and seconds. It's a shame we don't know how to distinguish 20 and 610 in the Babylonian system in plain text in Unicode.

Re: Octal number system

Posted: Thu Aug 15, 2019 12:11 pm
by Vijay
mèþru wrote: Thu Aug 15, 2019 11:41 am
Vijay wrote:Having written a paper for a grad seminar on numeric systems once, I've practically come to believe you can find a natural language somewhere that uses any number system, if it even bothers to use numbers at all.
Even base nine?
Is that different from base three?