45
$\begingroup$

Having had very little math(s) education I'm trying to bring myself up to speed for university, which currently involves teaching myself the times tables, where X is frequently used as the operator for multiplication (at least here in the UK). As far as I know this is the oldest multiplication symbol attested to in the Western world. I also know that beyond high-school level and especially in academia, the interpunct (·) is more common, and was originally advocated by Leibniz in a letter to Bernoulli:

"I do not like X as a symbol for multiplication, as it is easily confounded with x; ... often I simply relate two quantities by an interposed dot and indicate multiplication by ZC · LM."

Apparently it's also relatively common to use a simple full-stop, and I'm sure there are even more operators in use beyond these three.

Why then, given all these common and more intuitive options, do so many programming languages use an entirely new symbol (*) to indicate multiplication?

Which language first used the asterisk for multiplication, and what was the reasoning for doing so?

$\endgroup$
4
  • 1
    $\begingroup$ Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Programming Language Design and Implementation Meta, or in Programming Language Design and Implementation Chat. Comments continuing discussion may be removed. $\endgroup$
    – Michael Homer
    Sep 23, 2023 at 18:41
  • 1
    $\begingroup$ As a math educator for 15 years, I have always used asterisk, *, for multiplication. A.The principal reason being a student or significant percentage of students don't see the dot on the whiteboard, formerly chalkboards. Even now this important on video camera as I teach remotely and my students' internet is sporadic. B. As mentioned otherwise typing the raised dot, $\cdot$, on a standard keyboard is difficult. C. And of course the decimal point is inappropriate because it is leads to confusion with a decimal point. $\endgroup$
    – nickalh
    Oct 15, 2023 at 12:07
  • 3
    $\begingroup$ @nickalh × is a lot easier to write quickly and seems to be the most commonly understood by the general public, at least for the UK and possibly the US too. $\endgroup$ Oct 15, 2023 at 15:10
  • $\begingroup$ Related: Retrocomputing: Why do keyboards have an asterisk key? $\endgroup$
    – smci
    Mar 23 at 8:33

6 Answers 6

34
$\begingroup$

Maybe FORTRAN, maybe MATH-MATIC

FORTRAN's Preliminary Report in 1954 anticipated using the × symbol for multiplication (and ×× for exponentiation). The 1956 Programmer's Reference Manual, which is the first manual for a working version, notes that the multiplication symbol is *.

In the 1978 HOPL-I history of FORTRAN, John Backus claimed that the team were not influenced by any other languages as far as design goes, and specifically notes MATH-MATIC as a non-influence. Some syntax changes were made due to the 48 character set limit on punched cards (even the < symbol wasn't available, hence .LT.), but the team felt that language design was the easy part, and focused their efforts on compilation.

So we can say that some time between November 1954 and October 1956, FORTRAN adopted * as the multiplication symbol, and they claimed not to be influenced by any other work.

So that's what was happening at IBM.

Back over at Remington Rand, Grace Hopper's A-2 language, released around 1951-2 for the UNIVAC I, used a text mnemonic for multiplication.

The next iteration, A-3, was renamed by Remington Rand as ARITH-MATIC, which used essentially the same mnemonic. However, the arithmetic translator layer AT-3, named MATH-MATIC, was developed around the same time, in 1955. The preliminary manual was published in April 1957 and shows the * symbol for multiplication.

So it appears that FORTRAN and MATH-MATIC settled on this syntax independently. The implementations happened concurrently. FORTRAN shipped first, with AT-3 shipping less than a year later.

So while FORTRAN certainly shipped *-as-multiplication first, which one of the two designed it first and which one implemented it first... that's probably lost to history.

The Hopper family of languages became COBOL in 1959, and between them, FORTRAN and COBOL heavily influenced the arithmetic syntax of all subsequent languages.

$\endgroup$
6
  • 6
    $\begingroup$ "UNIVAC I, used a text mnemonic for multiplication" Not really relevant to the answer, but out of curiosity, what was that mnemonic? $\endgroup$
    – TripeHound
    Sep 21, 2023 at 13:26
  • 3
    $\begingroup$ It was actually the name of the subroutine that was called: AA0 was addition, AS0 was subtraction, AM0 was for multiplication and AD0 was for division. You can think of many early programming languages, including A-2, as really being about calling subroutines with some flow control on top. Today we would call it "threaded code". High-level Formula/Arithmetic translation was one of the big new research areas. See: archive.org/details/sim_computers-and-people_1955-09_4_9/page/… $\endgroup$
    – Pseudonym
    Sep 21, 2023 at 23:12
  • $\begingroup$ Offtopic, but do you mean that > was available even though < was not?? $\endgroup$
    – Sneftel
    Sep 22, 2023 at 8:54
  • $\begingroup$ @Sneftel In the HOPL paper linked above, Jim Backus specifically notes that < wasn't available. I don't know anything more specific than that. $\endgroup$
    – Pseudonym
    Sep 22, 2023 at 11:17
  • 1
    $\begingroup$ @Sneftel homepage.cs.uiowa.edu/%7Ejones/cards/codes.html shows some of the early character sets used. If I'm reading it correctly, > was available while < was not. (But someone else can double-check against the other linked document on the history of Fortran, to make sure I'm looking at the correct character set.) $\endgroup$ Apr 3 at 1:21
45
+100
$\begingroup$

I believe the first language to use * for multiplication was FORTRAN, in its original specification in 1956 (with earlier drafts).

None of the other symbols you suggest except the full stop were available in the character set in use on the machines, which predated the high-level language design and was taken as a given. It's only a relatively recent development that these other symbols are all in sufficiently widespread encodings together that choosing between them is an option.

However, in 1954 the FORTRAN authors were considering that a programmer

would like to write $\sum a_{ij} \cdot b_{jk}$ instead of the fairly involved set of instructions corresponding to this expression

as part of the work leading into FORTRAN. Clearly none of this made it into the language in that form: the symbols and subscripting just weren't feasible on the machines of the time, but X + Y also considered did, along with X * Y.

This was all for a punch-card system on the IBM 704, which used BCD encoding with 48 total code points. In some respects the assignment of symbols to codes there is arbitrary, but encodings did correspond to real physical hardware for printing and input. * is one of the few available characters without a more obvious mathematical meaning and has some resemblence to both × and ·, so it's not an unreasonable choice. Subsequent languages have inherited this convention, often via ALGOL or BASIC.

Similarly, "keyboard" symbols have a significant advantage over others. * was present on ordinary typewriters as a marker, and no standard layout has either of the others now. It also made its way into ASCII for the same reason. Much of this is historical contingency, rather than an overarching design, but once the symbol is in use then there is also value in consistency, which reinforces making it available, which reinforces using it.


Applied Science Division and Programming Research Dept, International Business Machines Corporation. 1956. FORTRAN Automatic Coding System for the IBM 704: Programmer's Reference Manual.

Backus, John W. and Herrick, Harlan. 1954. IBM 701 Speedcoding and other automatic programming systems. In Proceedings of the Symposium on Automatic Programming for Digital Computers.

$\endgroup$
12
  • 15
    $\begingroup$ This begs a follow-up question: why weren't any multiplication symbols included in character sets of early computers back the when computers were primarily a number crunching machines, not cat-pictures-watching-devices like today. $\endgroup$ Sep 21, 2023 at 8:14
  • 15
    $\begingroup$ @el.pescado-нетвойне: I suggest asking on the retro-computing stackexchange site, there's quite a few experts there, and someone may actually have a good answer :) $\endgroup$ Sep 21, 2023 at 8:32
  • 5
    $\begingroup$ I think the short answer is that the original BCD encoding mapping was made for printing commercial text (e.g. on cheques or reports) and there wasn't an encoding made specifically for these computers until several years later when it had been proved to be useful. On the cards themselves it's a bit arbitrary and to see the actual symbols translated took a printer. Retrocomputing will probably give you a more comprehensive or more correct answer! $\endgroup$
    – Michael Homer
    Sep 21, 2023 at 8:40
  • 5
    $\begingroup$ @el.pescado-нетвойне They did have multiplication. Not only was it on IBM's first computers (IBM 701 BCD), it dates to the 1950's punch cards. Being business machines, the multiplication character was the commercial at, @. On an invoice, you'd write WIDGETS 12 @ 1.50 18.00. $\endgroup$
    – user71659
    Sep 21, 2023 at 22:10
  • 2
    $\begingroup$ @elzell Isn't "12 pieces at 1.50 each" a multiplication, ultimately? $\endgroup$ Sep 22, 2023 at 16:55
44
+200
$\begingroup$

The other answers have covered the first uses of * in programming languages. To these I will add that the asterisk has been used as a symbol for multiplication in mathematics since as far back as 1668, by Swiss author Johan Heinrich Rahn and others (source).

The division symbol $\div$ was also introduced at about the same time. Both are out of favour in modern formal mathematical notation, but saw widespread use in the past and are still used informally. So it makes sense that the asterisk would have been considered as an option for the multiplication operator in programming language syntax.

$\endgroup$
2
  • 8
    $\begingroup$ Great observation; here's the primary source: google.com/books/edition/Teutsche_Algebra/… $\endgroup$
    – Xerxes
    Sep 21, 2023 at 13:26
  • 2
    $\begingroup$ Nice one - other answers explain why × and · are rare in programming languages, but this explains why * is the best alternative. $\endgroup$ Sep 23, 2023 at 9:49
35
+50
$\begingroup$

The fundamental reason is because neither true multiplication symbols × nor were (or are) common on US keyboards. Using symbols that are not available on the keyboard is a far bigger problem than learning a new symbol for multiplication because after the trivial learning bump of associating * with multiplication it has no real cost whereas as needing characters off the keyboard or using a compound symbol (e.g. .x.) is a permanent slowdown.

The alternatives of x and . have major problems of their own. Using x would have caused parsing problems and stopped x being used as a variable. Using . would have been even worse as it clashes with the use of a full stop as the decimal separator that is normal among English speakers. There could, presumably, have been other symbols used but * is the one closest in appearance to the × and most other symbols already had established meanings that would have prevented their use.

FORTRAN seems to have been the first language to adopt the convention in 1956 with the manual simply stating "The symbol * denotes multiplication" without explanation. From there it seems to have become ubiquitous but given how other languages have changed almost every convention in one way or another, the origin in FORTRAN does not seem to me to be a particularly important justification for the usage and I think the reasons given at the start of this answer are more important than historical accident - ultimately * is simply the only good solution for English speakers, perhaps had German speakers driven the development of programming languages we'd all use , as the decimal separator and . as multiplication.

$\endgroup$
14
  • 3
    $\begingroup$ And, speaking of German speakers, there would be a need for a separator of parameters in a function, and * would have been the only unused common symbol... Imagine calling f(2* 3,4* 5.6); instead of our f(2, 3.4, 5*6); $\endgroup$
    – vsz
    Sep 21, 2023 at 9:51
  • 2
    $\begingroup$ If you use a Spanish keyboard then the middle dot character · is very common ;-) $\endgroup$
    – Aaron F
    Sep 21, 2023 at 12:25
  • 4
    $\begingroup$ @AaronF: Indeed, many of the features of early programming languages (and inherited from them over time) are tied to their US-centric origins. $\endgroup$ Sep 21, 2023 at 12:56
  • 12
    $\begingroup$ @vsz Obviously this purely hypothetical, but the normal substitute for a comma separator is the semicolon in German (this is how German Excel formats CSV files btw). So it would more like be something like this f(2; 3,4; 5.6)\ if Germans had designed C. $\endgroup$
    – nanash1
    Sep 21, 2023 at 13:00
  • 2
    $\begingroup$ In most languages, allowing x to be both a variable name and an operator would not be impossible or impractical (except in FORTRAN). It would complicate lexing & parsing, to be sure. But since x as an operator is a binary operator, and x as a variable does not appear in the same positions as binary operators, I think it could be done. But it'd uglify parsing for not much gain (in my opinion). $\endgroup$ Sep 21, 2023 at 21:39
3
$\begingroup$

FORTRAN I

Based on some quick research, it appears that FORTRAN I was the first language to use * for multiplication. You can see a sample of FORTRAN I code here, which does appear to use *[1]

READ 1, N, (A(1), 1 * l,N)
...
DO 20, I * 2,N

(copied out the best I can read). There are also several examples around of FORTRAN II using * for multiplication[2], so it's really more up to whether FORTRAN I or II did it first.

You'd have to go back and either read the original FORTRAN tech reports or similar to figure out why they used *, but I'm assuming it's exactly because it looks similar to an interpunct.

As an anecdote, this would rather funnily indicate that using * for multiplication is quite literally as old as programming languages.

[1] http://www.paulgraham.com/history.html

[2] https://github.com/scivision/fortran-II-examples/blob/main/funcs58.f eg:

      term = -prevxp / presxp * y * term
$\endgroup$
1
  • 3
    $\begingroup$ Your [1] is not an asterisk and not multiplication. Expand the gif (e.g. to fullscreen) and you'll see it's a closely-spaced equal sign = meaning assignment just like the one in BIGA = A(1). And there's no lower-case ell l on machines of that vintage; the read list is (A(I), I=1,N). (I is a variable, 1 is not.) A DO-statement or I/O-implied-DO with no assignment wouldn't make any sense. $\endgroup$ Sep 22, 2023 at 0:36
1
$\begingroup$

As discussed on RetroComputing, the asterisk character existed on IBM punch cards before electronic computers:

"asterisk was added to IBM punch card codes 'somewhere around 1932' and was used for cheque protection. This was a 39-character set: alphanumerics, minus sign, ampersand, asterisk."

So, as discussed in other answers, it was appropriate, there was little other choice, and it existed.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .