Why do some people use the exclusive-or symbol to denote raising a number to a power?
As in writing "x^2" to mean x squared. In computing, ^ represents the EOR operation. Raising to powers is represented by a double star, like x**2.
- M.Lv 73 years ago
When were you born, asker?
Did you ever type on a typewriter?
- Anonymous3 years ago
Really, how often have people here used "exclusive or" in programming? I've done a fair amount and can't recall ever having need of it. Exponentiation, on the other hand, is very common if you do much calculation. I've used that frequently. I'm also old enough to remember languages that used ** instead of ^.
I think today a more likely question is, "Why do they use the exponentiation symbol to represent exclusive or?"
- busterwasmycatLv 73 years ago
The computer programming I did typically employed the carat rather than the double-asterix. Depends on the language of course.
- ComoLv 73 years ago
The signs most commonly used are :-
x ² or x^2 ______for x to power 2
x ³ or x^3______for x to power 3
- What do you think of the answers? You can sign in to give your opinion on the answer.
- husoskiLv 73 years ago
That "in computing" only refers to the C programming language, starting around 1972. BASIC was using the symbol in the ^ position of the ASCII code years before that; and Algol used the symbol before that, for powers.
For what it's worth, the early teletype and other terminal devices that the ASCII code was based on actually had an up arrow where ^ is today; so the "raised to the power" idea was a natural.
That's also why Pascal uses the ^ symbol as a pointer operator. The arrow naturally suggests a pointer. The ^ replaced the up-arrow in the official ASCII standards, and in languages that used it as such. You still see that in the Delphi programming language today.
I have no idea why Dennis Ritchie chose the ^ symbol for bitwise exclusive or for C. Two common symbols ($ and @) were available and never otherwise used in C; but may have been avoided because of character set variations for "international" versions of devices. Using one of those for the preprocessor would have left # available for exclusive-or. Oh well.
Someone mentioned ^ for "superscript" and _ for "subscript". These came along later, after email and then later Usenet newsgroups made technical communication on ASCII terminals commonplace. Extending ^ from "exponent" to "any superscript" is a natural extension. Using _ in front of a subscript was probably invented at that time, too. That's where I first saw it...in newsgroups like sci.math and alt.math.recreational. C was already pretty widespread by then, since most of the early Arpanet/Internet protocols were implemented in C. This part is "parallel evolution" I guess.
The ** notation for powers was used in FORTRAN, mostly because IBM Keypunch machines had very few symbols on them; and line printers usually had restricted character sets too. (Rather than put every character on a print chain; the normal chains in everyday use repeated common characters multiple times around the chain to speed up alphanumeric output--which was the normal bulk output in production use.) Today, Fortran and Python use that notation (** for powers) and not many others.
- llafferLv 73 years ago
It depends on the language.
This notation goes back to early BASIC and other early languages where ^ was the power notation.
Languages like C and Java no longer have a native power notation and has to rely on functions to perform those operations.
- Randy PLv 73 years ago
It isn't "some people". The caret (^) has been a standard symbol for "exponent" and "superscript" for a very long time, as the underscore (_) has been used to indicate subscript.
It's that way in the standard mathematical typesetting language LaTeX and in many other contexts. The double star was used in FORTRAN but I'm not sure what other languages use it. C and its descendents don't have an exponentiation operator.
Rather than "some people" you'll find it's pretty universal to use the caret in mathematical forums. EVERYBODY does it.
- DWReadLv 73 years ago
"In computing, ^ represents the EOR operation."
In computer programming and spreadsheet software, ^ indicates an exponent.