Usage in Mathematics and Computer Programming
In mathematics, the equals sign may express a simple statement of fact (x = 2), a definition (let x = 2), or a condition (if x = 2 then...).
The first important computer programming language to use the equals sign was the original version of Fortran, FORTRAN I, designed in 1954 and implemented in 1957. In Fortran, "=" serves as an assignment operator: X = 2
sets the value of X
to 2. This somewhat resembles the use of "=" in a mathematical definition, but with different semantics: the expression following "=" is evaluated first and may refer to a previous value of X
. For example, the assignment X = X + 2
increases the value of X
by 2.
A rival programming-language usage was pioneered by the original version of ALGOL, which was designed in 1958 and implemented in 1960. ALGOL included a relational operator that tested for equality, allowing constructions like if x = 2
with essentially the same meaning of "=" as the conditional usage in mathematics. The equals sign was reserved for this usage.
Both usages have remained common in different programming languages into the early 21st century. As well as Fortran, "=" is used for assignment in such languages as C, Perl, Python, awk, and their descendants. But "=" is used for equality and not assignment in the Pascal family, Ada, Eiffel, APL, and other languages.
A few languages, such as BASIC and PL/I, have used the equals sign to mean both mean assignment and equality, distinguished by context. However, in most languages where "=" has one of these meanings, a different character or, more often, a sequence of characters is used for the other meaning. Following ALGOL, most languages that use "=" for equality use ":=" for assignment, although APL, with its special character set, uses a left-pointing arrow.
Fortran did not have an equality operator (it was only possible to compare an expression to zero, using the arithmetic IF statement) until FORTRAN IV was released in 1962, since when it has used the four characters ".EQ." to test for equality. The language B introduced the use of "==" with this meaning, which has been copied by its descendant C and most later languages where "=" means assignment.
Read more about this topic: Equals Sign
Famous quotes containing the words usage, mathematics, computer and/or programming:
“I am using it [the word perceive] here in such a way that to say of an object that it is perceived does not entail saying that it exists in any sense at all. And this is a perfectly correct and familiar usage of the word.”
—A.J. (Alfred Jules)
“Mathematics alone make us feel the limits of our intelligence. For we can always suppose in the case of an experiment that it is inexplicable because we dont happen to have all the data. In mathematics we have all the data ... and yet we dont understand. We always come back to the contemplation of our human wretchedness. What force is in relation to our will, the impenetrable opacity of mathematics is in relation to our intelligence.”
—Simone Weil (19091943)
“The Buddha, the Godhead, resides quite as comfortably in the circuits of a digital computer or the gears of a cycle transmission as he does at the top of a mountain or in the petals of a flower.”
—Robert M. Pirsig (b. 1928)
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)