16

In what programming language did the use of the percent sign (%) to mean modulo/remainder originate?

This previous post1 explains that the symbol % was likely chosen because it includes a slash, clever for an operation related to division. It also mentions the influence of C's use of the symbol. However, I'm not certain that it originated in C. The B programming language was a precursor to C, and I've found a User's guide for B (PDF, page 12) that states:

The operator % denotes modulo. If both operands are positive, the result is correct. It is undefined otherwise.

That user's guide is dated 1972 though, approximately when C appeared. That makes it still theoretically possible to have originated in C, but then back-ported to B. I've also not yet been able to find specifications for other languages prior to this indicating use of the % symbol.


  1. To which I believe this question is not a duplicate: That one asks why the modulo operation is fundamental, I'm asking about when the symbol in particular appeared to mean modulo.
10

The earliest reference I can find is from the "B" programming language developed by Ken Thompson with Dennis Ritchie around 1969. B Reference

As this was an implementation/improvement of BPCL I have to assume the operator was part of BPCL but I cannot find a specific reference for this.

  • 4
    Apparently it was "rem" in BPCL (See comment from BobDalgleish ) – James Anderson Aug 22 '15 at 7:27
  • Based on the link it could not have been 1969 IF the implementation presented was the first. Honeywell did not buy GE Computer Division until 1970 and the paper definitely referenced a H6070 computer. Ritchie and Thompson worked on Project MAC in the 60's multicians.org/unix.html . – dbasnett Aug 22 '15 at 13:51
  • Another Multics BCPL ref. multicians.org/mgb.html#BCPL – dbasnett Aug 22 '15 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.