Why octal is important (via @jpluimers on Twitter: “@b0rk @jilles_com Acids vs bases.”)
Posted by jpluimers on 2026/03/03
A few years back I tweeted [Wayback/Archive] Jeroen Wiert Pluimers @wiert@mastodon.social on Twitter: “@b0rk @jilles_com Acids vs bases.”
It was a kind of tongue-in-cheek reaction (with a way better picture below) to a very valuable post by b0rk (Julia Evans) on both Twitter and Mastodon [Wayback/Archive] Julia Evans on Twitter: “bases” / [Wayback/Archive] Julia Evans: “bases title: bases # we usually…” – Mastodon for two reasons:
- There are various interpretations of bases
- Octal is very important to educate as errors introduced by its support are hard to spot even if you do know about octal.
Back to Julia’s post:
title: bases
# we usually write numbers in base
2503 = 2000 + 500 + 0 + 3
(picture of a bunch of powers of 10 being added up to make 2503 — 1000s, 100s, 10s, 0s)
# but you can write numbers in any base
here’s 10 in base 2:
1 0 0 1 0
16 + 0 + 0 + 2 + 0 = 18
(picture of a bunch of powers of 2 being added up to make 18: 16, 8, 4, 2, 1)
# we use 4 bases with computers
* base 2 (binary)
* base 8 (octal)
* base 10 (decimal)
* base 16 (hexadecimal)octal is the least common by far
# how to convert from base 10 to base 20
Let’s convert 19! we’ll start at the end and move left
1. divide by 2: 19 / 2 = 9 remainder 1
2. write the remainder (1) below and 9 on the left
3. repeat(picture of 19 -> 9 -> 4 -> 2 -> 1 , with the remainders 1, 0, 0, 1, 1)
the answer is 10011!
Octals are rarely used, but because of that they unexpectedly can rear their ugly head
Julia considers dropping the octal numbers in a response to [Wayback/Archive] Maxime Chevalier on Twitter: “@b0rk Octal seems to have largely fallen out of favor. It’s kind of an artifact of a different era (1960s mainframes) AFAIK. One thing I found very insightful for getting an intuitive sense of binary is looking at a binary counter in action:”
[Wayback/Archive] Mechanical Binary Counter _ 1 min – YouTube
[Wayback/Archive] Julia Evans on Twitter: “@Love2Code yeah I might remove octal, the only place I ever see it is unix permissions and maybe it’s not worth including just for that”
Like others, I disagreed, so here are some of the responses I think are important:
- [Wayback/Archive] Scott Manley on Twitter: “@b0rk @Love2Code It was used for the Apollo Guidance computer, and Pilots still use it today with Transponder codes.”
- [Wayback/Archive] @lafp@cornputer.org on Twitter: “@b0rk @Love2Code Useless trivia: the original 8086 opcodes were grouped by groups of 8 instructions, making it easier to see what a particular opcode does by looking at it in octal rather than hex! When I was writing a PC emulator, the decoder was based on a “binary coded octal” concept”Note that this especially true for the ModR/M byte of applicable instructions, see the links below.
- [Wayback/Archive] Paweł Lasek on Twitter: “@b0rk @Love2Code Octal maps very nicely into 3 bit patterns, I find myself using it still sometimes”
- [Wayback/Archive] Jeroen Wiert Pluimers @wiert@mastodon.social on Twitter: “@b0rk @Love2Code That and support in languages like Python, Perl, Java, JavaScript, C, bash and others, and usage IPv4 network quads, seven-segment displays and other places. Please keep octals included as they keep rearing their ugly heads in unexpected places even for old farts like me.”
Likewise, there were some interesting responses to the octal bits in Mastodon as well:
- [Wayback/Archive] Barney Dellar (he/him): “@b0rk Have you come across any uses of Octal? I’ve never seen it in use (other than the fact that a literal 0 is in Octal in C++)” – mastodon.scot
- [Wayback/Archive] Julia Evans: “@BarneyDellar only in unix permissions, I might remove it” – Mastodon
- [Wayback/Archive] Julia Evans: “@b0rk @BarneyDellar It’s useful to know about octal (and how it’s written). I once assigned IP-Numbers
a.b.c.XYtocomputerXYand wrote that with leading zeroes (because it looks nicer and is less work to generate) in/etc/hosts. Guess what happened? Couldn’t reachcomputer08andcomputer09…” – Mastodon - [Wayback/Archive] Dave Fischer: “@BarneyDellar @b0rk Octal was widely used in the 60s & 70s because it’s easy to read octal and “type” binary on front panel switches. (Note those switches are color coded in groups of three. Three bits = one octal digit.)” – Hachyderm.io

- [Wayback/Archive] We Could All Use A Li’l Change: “Obligatory “Zero Wing” reference
youtu.be/8fvTxv46ano” – Dice.camp

[Wayback/Archive] All Your Base Are Belong To Us (Original) – YouTube
Octals can get you in trouble and will if you do not knowing about them
My argument of including information about octal numbers is that lack of knowledge about octal, especially like shown in the first Mastodon reaction, makes it easier to introduce failures and harder to see benefits.
The failures mainly come because some languages and tools use the prefix zero (0) for octal numbers. This gets more confusing when the same tools on different platforms use different rules. This can result in the same source code causing bugs that manifest themselves on some platforms but not the others.
The most well known problem here it the interpretation of IPv4 addresses, where something like 077.016.042.061 gives different results in different environments.
Similarly, date input like 07-09-1964 cannot only reverse date and month, but also fail on the 09 as it is not a valid octal number.
On the IPv4 side, most platforms interpret 0127.0.0.1 as 87.0.0.1 instead of 127.0.0.1.
Some examples in failures:
- [Wayback/Archive] [JDK-8206451] LocalDate.of method considers 08 or 09 as invalid month but 8 or 9 works fine – Java Bug System
- [Wayback/Archive] Critical netmask networking bug impacts thousands of applications: Leading zero changes the IP address
- [Wayback/Archive] Javascript parseInt gives very unexpected results – Stack Overflow (thanks [Wayback/Archive] Tomas Aschan and [Wayback/Archive] Tomalak)
This problem arises for august and september, and for the 8th and 9th every month – that is, when either
"08"or"09"is being parsed to integer,0is returned instead of8or9. The code works for both lower (e.g."07") and higher (e.g."10") integers (at least within expected date ranges…)…
- [Wayback/Archive] integer – How do I work around JavaScript’s parseInt octal behavior? – Stack Overflow (and [Wayback/Archive] Portman and [Wayback/Archive] Paolo Bergantino)
Try executing the following in JavaScript:
parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals 3 parseInt('04'); //equals 4 parseInt('05'); //equals 5 parseInt('06'); //equals 6 parseInt('07'); //equals 7 parseInt('08'); //equals 0 !! parseInt('09'); //equals 0 !!I just learned the hard way that JavaScript thinks the leading zero indicates an octal integer, and since there is no
"8"or"9"in base-8, the function returns zero. Like it or not, this is by design.
Yes I know some of the problems like these can and have ben fixed. But others can’t or won’t, so better know about this.
Humans already know about base 10 (obviously), base 12 and often 24 (hours per half day and hours per day), base 60 (minutes and seconds), base 20 (especially in many European languages) and base 5 (part of the ancestry of the the Roman numbering system). Given that most IT people can learn base 2 and 16, they surely should be able to get a bit familiar with basics of base 8 bringing these numeral systems:
- 2 Binary number – Wikipedia
- 5 Quinary – Wikipedia
- 8 Octal – Wikipedia
- 10 Decimal – Wikipedia
- 12 Duodecimal – Wikipedia
- 16 Hexadecimal – Wikipedia
- 20 Vigesimal – Wikipedia
- 24 Tetravigesimal – Wikipedia
- 60 Sexagesimal – Wikipedia
Where are octals supported?
Here are some links on real world octal usage and failure (I reworked most what I did from the top of my mind in the tweet to links originating from the Wikipedia Octal entry):
- Octal – Wikipedia
- File-system permissions – Wikipedia
These are the examples from the symbolic notation section given in octal notation:
Symbolic
notationNumeric
notationEnglish ----------0000 no permissions -rwx------0700 read, write, & execute only for owner -rwxrwx---0770 read, write, & execute for owner and group -rwxrwxrwx0777 read, write, & execute for owner, group and others ---x--x--x0111 execute --w--w--w-0222 write --wx-wx-wx0333 write & execute -r--r--r--0444 read -r-xr-xr-x0555 read & execute -rw-rw-rw-0666 read & write -rwxr-----0740 owner can read, write, & execute; group can only read; others have no permissions - chmod – Wikipedia
Numerical permissions
The chmod numerical format accepts up to four digits. The three rightmost digits define permissions for the file user, the group, and others. The optional leading digit, when 4 digits are given, specifies the special setuid, setgid, and sticky flags. Each digit of the three rightmost digits represents a binary value, which controls the “read”, “write” and “execute” permissions respectively. A value of 1 means a class is allowed that action, while a 0 means it is disallowed.
# Sum rwx Permission 74(r) + 2(w) + 1(x) rwxread, write and execute 64(r) + 2(w) rw-read and write 54(r) + 1(x) r-xread and execute 44(r) r--read only 32(w) + 1(x) -wxwrite and execute 22(w) -w-write only 11(x) --xexecute only 00 ---none For example,
754would allow:- “read” (4), “write” (2), and “execute” (1) for the User class; i.e., 7 (4 + 2 + 1).
- “read” (4) and “execute” (1) for the Group class; i.e., 5 (4 + 1).
- Only “read” (4) for the Others class
- chmod – Wikipedia
- UTF-8: octal – Wikipedia
UTF-8’s use of six bits per byte to represent the actual characters being encoded means that octal notation (which uses 3-bit groups) can aid in the comparison of UTF-8 sequences with one another and in manual conversion.
Octal code point ↔ Octal UTF-8 conversion First code point Last code point Code point Byte 1 Byte 2 Byte 3 Byte 4 000 0177 xxx xxx 0200 03777 xxyy 3xx 2yy 04000 077777 xyyzz 34x 2yy 2zz 0100000 0177777 1xyyzz 35x 2yy 2zz 0200000 04177777 xyyzzww 36x 2yy 2zz 2ww With octal notation, the arbitrary octal digits, marked with x, y, z or w in the table, will remain unchanged when converting to or from UTF-8.
- Example: Á = U+00C1 = 0301 (in octal) is encoded as 303 201 in UTF-8 (C3 81 in hex).
- Example: € = U+20AC = 020254 is encoded as 342 202 254 in UTF-8 (E2 82 AC in hex).
- Octal: in aviation – Wikipedia
- Apollo Guidance Computer – Wikipedia
A set of user-accessible routines were provided to let the astronauts display the contents of various memory locations in octal or decimal in groups of 1, 2, or 3 registers at a time.
- Squawk code: transponder codes – Wikipedia
Codes are made of four octal digits; the dials on a transponder read from zero to seven, inclusive. Four octal digits can represent up to 4096 different codes, which is why such transponders are sometimes described as “4096 code transponders.”
- Apollo Guidance Computer – Wikipedia
- Octal: in computers – Wikipedia
- PDP-11 – Wikipedia
The CPU microcode includes a debugger: firmware with a direct serial interface (RS-232 or current loop) to a terminal. This lets the operator do debugging by typing commands and reading octal numbers, rather than operating switches and reading lights, the typical debugging method at the time.
- Motorola 68000 series – Wikipedia
The 68000 series has eight 32-bit general-purpose data registers (D0-D7), and eight address registers (A0-A7).
- Opcode table – Wikipedia
- ModR/M – Wikipedia
The prefix
0oalso follows the model set by the prefix0xused for hexadecimal literals in- C syntax – Wikipedia
Integer constants may be specified in source code in several ways. Numeric values can be specified as decimal (example:
1022), octal with zero (0) as a prefix (01776), or hexadecimal with 0x (zero x) as a prefix (0x3FE). - [Wayback/Archive] Haskell 98 Lexical Structure
2.5 Numeric Literals
decimal -> digit{digit} octal -> octit{octit} hexadecimal -> hexit{hexit} integer -> decimal | 0ooctal |0Ooctal| 0xhexadecimal |0Xhexadecimalfloat -> decimal .decimal [exponent]| decimal exponent exponent -> ( e|E) [+|-] decimalThere are two distinct kinds of numeric literals: integer and floating. Integer literals may be given in decimal (the default), octal (prefixed by
0oor0O) or hexadecimal notation (prefixed by0xor0X). Floating literals are always decimal. A floating literal must contain digits both before and after the decimal point; this ensures that a decimal point cannot be mistaken for another use of the dot character. - [Wayback/Archive] OCaml – The OCaml language
An integer literal is a sequence of one or more digits, optionally preceded by a minus sign. By default, integer literals are in decimal (radix 10). The following prefixes select a different radix:Prefix Radix 0x,0Xhexadecimal (radix 16) 0o,0Ooctal (radix 8) 0b,0Bbinary (radix 2) (The initial 0 is the digit zero; the O for octal is the letter O.) - [Wayback/Archive] 2. Lexical analysis — Python v3.1.5 documentation
The recognized escape sequences are:Escape Sequence Meaning Notes \newlineBackslash and newline ignored \\Backslash ( \)\'Single quote ( ')\"Double quote ( ")\aASCII Bell (BEL) \bASCII Backspace (BS) \fASCII Formfeed (FF) \nASCII Linefeed (LF) \rASCII Carriage Return (CR) \tASCII Horizontal Tab (TAB) \vASCII Vertical Tab (VT) \oooCharacter with octal value ooo(1,3) \xhhCharacter with hex value hh(2,3) Escape sequences only recognized in string literals are:Escape Sequence Meaning Notes \N{name}Character named namein the Unicode database\uxxxxCharacter with 16-bit hex value xxxx(4) \UxxxxxxxxCharacter with 32-bit hex value xxxxxxxx(5) Notes:- As in Standard C, up to three octal digits are accepted.
- Unlike in Standard C, exactly two hex digits are required.
- In a bytes literal, hexadecimal and octal escapes denote the byte with the given value. In a string literal, these escapes denote a Unicode character with the given value.
- [Wayback/Archive] Synopsis 2: Bits and Pieces
Radix markers
Initial
0no longer indicates octal numbers by itself. You must use an explicit radix marker for that. Pre-defined radix prefixes include:0b base 2, digits 0..1 0o base 8, digits 0..7 0d base 10, digits 0..9 0x base 16, digits 0..9,a..f (case insensitive)Each of these allows an optional underscore after the radix prefix but before the first digit. These all mean the same thing:
0xbadcafe 0xbad_cafe 0x_bad_cafeGeneral radices
The general radix form of a number involves prefixing with the radix in adverbial form:
:10<42> same as 0d42 or 42
:16<DEAD_BEEF> same as 0xDEADBEEF
:8<177777> same as 0o177777 (65535)
:2<1.1> same as 0b1.1 (0d1.5)
- [Wayback/Archive] ruby/to_i_spec.rb at master · ruby/ruby
it "auto-detects base 8 via leading 0 when base = 0" do "01778".to_i(0).should == 0177 "-01778".to_i(0).should == -0177 end ... it "auto-detects base 8 via 0o when base = 0" do "0o178".to_i(0).should == 0o17 "-0o178".to_i(0).should == -0o17 end - [Wayback/Archive] Tcl and octal numbers
Tcl mathematical operation commands treat strings begininning with 0 as octal numbers, catching the unsuspecting programmer off-guard.
- [Wayback/Archive] Explicit Octal numeral notation – PHP 8.1 • PHP.Watch
PHP supports various numeral systems, including the default decimal (base-10), binary (base-2), octal (base-8), and hex (base-16).
Numeral systems apart from decimal are prefixed with their own prefix:
- Hex with
0xprefix: e.g.0x11= 17 - Binary with
0bprefix: e.g.0b11= 3 - Octal with
0prefix: e.g.011= 9
In PHP 8.1 and later, Octal numerals also support the
0o(zero, followed by o as in Oscar) prefix, which means octal numeric literals can be made more obvious and readable that they are indeed octal numerals.0O(zero, followed by upper case O as in Oscar) is also supported. - Hex with
- [Wayback/Archive] Literals and operators – Rust By Example
Integers can, alternatively, be expressed using hexadecimal, octal or binary notation using these prefixes respectively:
0x,0oor0b. - [Wayback/Archive] ECMAScript Language Specification ECMA-262 6th Edition – DRAFT
Numeric Literals
Syntax
NumericLiteral ::DecimalLiteralBinaryIntegerLiteralOctalIntegerLiteralHexIntegerLiteral…OctalIntegerLiteral ::0oOctalDigits0OOctalDigitsOctalDigits ::OctalDigitOctalDigits OctalDigitOctalDigit :: one of01234567… - [Wayback/Archive] Why does the radix for JavaScript’s parseInt default to 8? – Stack Overflow
It only “defaults” to 8 if the input string starts with 0. This is an unfortunate carryover from C and C++.You can useNumber('0123')instead, or, as you said in the question,parseInt('0123', 10). - [Wayback/Archive] parseInt() – JavaScript | MDN
Note: Other prefixes like
0b, which are valid in number literals, are treated as normal digits byparseInt().parseInt()does not treat strings beginning with a0character as octal values either. The only prefix thatparseInt()recognizes is0xor0Xfor hexadecimal values — everything else is parsed as a decimal value ifradixis missing.
Octal numbers that are used in some programming languages (C, Perl, PostScript…) for textual/graphical representations of byte strings when some byte values (unrepresented in a code page, non-graphical, having special meaning in current context or otherwise undesired) have to be to escaped as
\nnn. Octal representation may be particularly handy with non-ASCII bytes of UTF-8, which encodes groups of 6 bits, and where any start byte has octal value\3nnand any continuation byte has octal value\2nn.- Escape sequences in C – Wikipedia
Escape sequence Hex value in ASCII Character represented … … … \nnnany The byte whose numerical value is given by nnninterpreted as an octal number… … … - [Wayback/Archive] perldata – Perl data types – Perldoc Browser
Scalar value constructors
Numeric literals are specified in any of the following floating point or integer formats:
12345 12345.67 .23E-10 # a very small number 3.14_15_92 # a very important number 4_294_967_296 # underscore for legibility 0xff # hex 0xdead_beef # more hex 0377 # octal (only numbers, begins with 0) 0o12_345 # alternative octal (introduced in Perl 5.33.5) 0b011011 # binary 0x1.999ap-4 # hexadecimal floating point (the 'p' is required)You are allowed to use underscores (underbars) in numeric literals between digits for legibility (but not multiple underscores in a row:
23__500is not legal;23_500is). You could, for example, group binary digits by threes (as for a Unix-style mode argument such as 0b110_100_100) or by fours (to represent nibbles, as in 0b1010_0110) or in other groups.String literals are usually delimited by either single or double quotes. They work much like quotes in the standard Unix shells: double-quoted string literals are subject to backslash and variable substitution; single-quoted strings are not (except for
\'and\\). The usual C-style backslash rules apply for making characters such as newline, tab, etc., as well as some more exotic forms. See “Quote and Quote-like Operators” in perlop for a list.Hexadecimal, octal, or binary, representations in string literals (e.g. ‘0xff’) are not automatically converted to their integer representation. The hex() and oct() functions make these conversions for you. See “hex” in perlfunc and “oct” in perlfunc for more details.
- [Wayback/Archive] https://www.adobe.com/jp/print/postscript/pdfs/PLRM.pdf (PostScript® LANGUAGE REFERENCE, third edition)
Within a text string, the
\(backslash) character is treated as an “escape” for various
purposes, such as including newline characters, unbalanced parentheses, and
the\character itself in the string. The character immediately following the\determines
its precise interpretation.\nline feed (LF)
\rcarriage return (CR)
\thorizontal tab
\bbackspace
\fform feed
\\backslash
\(left parenthesis
\)right parenthesis
\dddcharacter codeddd(octal)The
\dddform may be used to include any 8-bit character constant in a string.
One, two, or three octal digits may be specified, with high-order overflow ignored.
This notation is preferred for specifying a character outside the recommended
ASCII character set for the PostScript language, since the notation itself
stays within the standard set and thereby avoids possible difficulties in transmitting
or storing the text of the program. It is recommended that three octal digits
always be used, with leading zeros as needed, to prevent ambiguity. The string
(\0053), for example, contains two characters—an ASCII5(Control-E) followed
by the digit3—whereas the strings (\53) and (\053) contain one character, the
ASCII character whose code is octal53(plus sign).
- PDP-11 – Wikipedia
- File-system permissions – Wikipedia
- [Wayback/Archive] Octal Literal Java – Google Search
- [Wayback/Archive] Java Data Type How to – Declare integer literals as octal values
Octal values is base8.Legal digits in an octal literal can be from0to7.Octal literals are with a leading zero, for example035and067. - [Wayback/Archive] how to set value of octal in java? – Stack Overflow (thanks [Wayback/Archive] Kapil and [Wayback/Archive] Jon Skeet)
A
why i cant give 018 and 019 to variable.
Because an integer literal prefixed with
0is treated as octal, and ‘8’ and ‘9’ aren’t valid octal digits.From section 3.10.1 of the JLS:
An octal numeral consists of an ASCII digit 0 followed by one or more of the ASCII digits 0 through 7 interspersed with underscores, and can represent a positive, zero, or negative integer.
Trying to use ‘8’ in an octal number is like trying to use ‘G’ in hex… it’s simple not part of the set of symbols used in that base.
- [Wayback/Archive] Chapter 3. Lexical Structure: 3.10.1. Integer Literals
…
An octal numeral consists of an ASCII digit
0followed by one or more of the ASCII digits0through7interspersed with underscores, and can represent a positive, zero, or negative integer.OctalNumeral:
0OctalDigits
0Underscores OctalDigitsOctalDigits:
OctalDigit
OctalDigit OctalDigitsAndUnderscoresopt OctalDigitOctalDigit: one of
0 1 2 3 4 5 6 7OctalDigitsAndUnderscores:
OctalDigitOrUnderscore
OctalDigitsAndUnderscores OctalDigitOrUnderscoreOctalDigitOrUnderscore:
OctalDigit
_Note that octal numerals always consist of two or more digits;
0is always considered to be a decimal numeral – not that it matters much in practice, for the numerals0,00, and0x0all represent exactly the same integer value.…
- [Wayback/Archive] Java Data Type How to – Declare integer literals as octal values
- [Wayback/Archive] Octal Literal bash – Google Search
- [Wayback/Archive] Numerical Constants
A shell script interprets a number as decimal (base 10), unless that number has a special prefix or notation. A number preceded by a 0 is octal (base 8). A number preceded by 0x is hexadecimal (base 16). A number with an embedded # evaluates as BASE#NUMBER (with range and notational restrictions).
- [Wayback/Archive] Special Characters: Octal Escape Sequences
Outside of the characters that you can type on your keyboard, there are a lot of other characters you can print on your screen. I’ve created a script to allow you to check out what the font you’re using has available for you. The main command you need to use to utilize these characters is “echo -e”. The “-e” switch tells echo to enable interpretation of backslash-escaped characters. What you see when you look at octal 200-400 will be very different with a VGA font from what you will see with a standard Linux font. Be warned that some of these escape sequences have odd effects on your terminal, and I haven’t tried to prevent them from doing whatever they do. The linedraw and block characters that are used heavily by the Bashprompt project are between octal 260 and 337 in the VGA fonts.
- [Wayback/Archive] Numerical Constants
- [Wayback/Archive] Octal Literal IPv4 – Google Search
- [Wayback/Archive] IPv4 addresses are silly, inet_aton(3) doubly so.
…
Alright, alright, I think you probably already know where this is going. All of the above are simply examples of a peculiar way of specifying IPv4 addresses that, for historical reasons, a specific library function accepts: inet_aton(3):
Values specified using the "dotted quad" notation take one of the follow- ing forms: a.b.c.d a.b.c a.b aThis weird convention dates back to the days of classful networking, where the leading bits of an IPv4 address indicated the length of the network- and host portions of the address. And while we’re used to specifying IPv4 addresses in full dotted-decimal notation (i.e., a.b.c.d), it’s useful to remember that at the end of the day, an IPv4 address is just a 32-bit number, and we can express numbers in a variety of ways. inet_aton(3) accepts these different notations, so let’s see what each of those means specifically.
Dotted-Decimal Addresses
When four parts are specified, each is interpreted as a byte of data and assigned, from left to right, to the four bytes of an Internet address.
Ok, not much to see here, that’s what we expect — something like 166.84.7.99 — although we’ll get back to some surprises with this format a bit further down. For now, let’s move on.
Single part or number
When only one part is given, the value is stored directly in the network address without any byte rearrangement.
All numbers supplied as “parts” in a “dotted quad” notation may be decimal, octal, or hexadecimal, as specified in the C language (i.e., a leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal; otherwise, the number is interpreted as decimal).
…
- [Wayback/Archive] inet_aton(3) – NetBSD Manual Pages
All numbers supplied as ``parts'' in a "dotted quad" notation may be dec- imal, octal, or hexadecimal, as specified in the C language (i.e., a leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal; otherwise, the number is interpreted as decimal). - Dot-decimal notation – Wikipedia
A popular implementation of IP networking, originating in 4.2BSD, contains a function
inet_aton()for converting IP addresses in character string representation to internal binary storage. In addition to the basic four-decimals format and 32-bit numbers, it also supported intermediate syntax forms ofoctet.24bits(e.g.10.1234567; for Class A addresses) andoctet.octet.16bits(e.g.172.16.12345; for Class B addresses). It also allowed the numbers to be written in hexadecimal and octal representations, by prefixing them with 0x and 0, respectively. These features continue to be supported in some software, even though they are considered as non-standard. This means addresses with a component written with a leading zero digit may be interpreted differently in programs that do or do not recognize such formats. - Classful network – Wikipedia
- [Wayback/Archive] IPv4 addresses are silly, inet_aton(3) doubly so.
- The 6502 is from the same era as the 8008 and 8080. It too uses octal as base for the instruction set (via [Wayback/Archive] 6502 octal – Google Search):
- [Wayback/Archive] assembly – What is the significance of $ # and % in 6502? – Stack Overflow (thanks [Wayback/Archive] tabol and [Wayback/Archive] Michael)
A
DASM allows numbers to be expressed in binary, octal, decimal, and hexadecimal.- Binary numbers use the
%prefix (e.g.%1101). - Octal numbers use the
0prefix (e.g.015). - Decimal numbers use no prefix (e.g.
13). - Hexadecimal numbers use the
$prefix (e.g.$0D).
The#symbol is used to specify immediate addressing:LDA 0 ; Load the byte from address 0 in memory into register A LDA #0 ; Load the value 0 into register AOne can of course combine immediate addressing with a different numeric base, e.g.:LDA #$FF ; Load the value $FF into register A - Binary numbers use the
- [Wayback/Archive] 6502 Instruction Set: layout
The 6502 instruction table is laid out according to a patterna–b–c, where
aandbare an octal number each, followed by a group of two binary digitsc,
as in the bit-vector “aaabbbcc“.aaabbbccbit 76543210(0…7)(0…7)(0…3)Example:
AllRORinstructions sharea = 3andc = 2(3b2) with the address mode inb.
At the same time, all instructions addressing the zero-page shareb = 1(a1c).
abc = 312 => ( 3 << 5 | 1 << 2 | 2 ) = %011.001.10 = $66“ROR zpg“.
- [Wayback/Archive] assembly – What is the significance of $ # and % in 6502? – Stack Overflow (thanks [Wayback/Archive] tabol and [Wayback/Archive] Michael)
- [Wayback/Archive] 80×86 Opcodes: Instructions shows a few octal tables as part of the instructions:
- mmm : Function
- 000 : DS:[BX+SI]
- 001 : DS:[BX+DI]
- 010 : SS:[BP+SI]
- 011 : SS:[BP+DI]
- 100 : DS:[SI]
- 101 : DS:[DI]
- 110 : SS:[BP]
- 111 : DS:[BX]
- rrr : W=0 : W=1 : reg32
- 000 : AL : AX : EAX
- 001 : CL : CX : ECX
- 010 : DL : DX : EDX
- 011 : BL : BX : EBX
- 100 : AH : SP : ESP
- 101 : CH : BP : EBP
- 110 : DH : SI : ESI
- 111 : BH : DI : EDI
- sss : Segment Register
- 000 : ES
- 001 : CS
- 010 : SS
- 011 : DS
- 100 : FS (Only 386+)
- 101 : GS (Only 386+)
- rrr : Index Register
- 000 : EAX
- 001 : ECX
- 010 : EDX
- 011 : EBX
- 100 : No Index
- 101 : EBP
- 110 : ESI
- 111 : EDI
- mmm : Function
Better acid/bases image and background
Bases is used in various contexts, and with a background in chemistry, bases versus acids (often called alkali, though not al bases are alkali).
The [Wayback/Archive] Acids and bases – introduction — Science Learning Hub explains the concept of acids and bases better than I can and has this great detailed pH scale picture categorising where “common” liquids are rated at:
Queries
Some of the queries I used (I forgot to save some, sorry):
- [Wayback/Archive] Octal Literal Java – Google Search
- [Wayback/Archive] octal site:https://perldoc.perl.org – Google Search
- [Wayback/Archive] postscript “octal” site:adobe.com – Google Search
- [Wayback/Archive] 6502 octal – Google Search
--jeroen







Leave a comment