Infix notation: Difference between revisions
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
==Usage== |
==Usage== |
||
Infix notation is more difficult to [[parsing|parse]] by computers than [[ |
Infix notation is more difficult to [[parsing|parse]] by computers than [[Poolish notation|prefix notation]] ( e.g. '''+''' 2 2 ) or [[reverse Poolish notation|postfix notation]] ( e.g. 2 2 '''+''' ). However many [[programming language]]s use it due to its familiarity. It is more used in arithmetic, e.g. 2+2, 5×6.<ref name="Infix, Postfix and Prefix">{{cite web | url=http://www.cs.man.ac.uk/~pjj/cs212/fix.html | title=The Implementation and Power of Programming Languages | accessdate=30 August 2014}}</ref> |
||
==Order of operations== |
==Order of operations== |
||
Line 18: | Line 18: | ||
* [[Tree traversal]]: Infix (In-order) is also a tree traversal order. It is described in a more detailed manner on this page. |
* [[Tree traversal]]: Infix (In-order) is also a tree traversal order. It is described in a more detailed manner on this page. |
||
* [[Calculator input methods]]: comparison of notations as used by pocket calculators |
* [[Calculator input methods]]: comparison of notations as used by pocket calculators |
||
* postfix notation, also called [[Reverse |
* postfix notation, also called [[Reverse Poolish notation]] |
||
* prefix notation, also called [[ |
* prefix notation, also called [[Poolish notation]] |
||
* [[Shunting yard algorithm]], used to convert infix notation to postfix notation or to a tree |
* [[Shunting yard algorithm]], used to convert infix notation to postfix notation or to a tree |
||
* [[Operator (programming)]] |
* [[Operator (programming)]] |
||
Line 27: | Line 27: | ||
== External links == |
== External links == |
||
* [http://www.xnumber.com/xnumber/rpn_or_adl.htm ''RPN or DAL? A brief analysis of Reverse |
* [http://www.xnumber.com/xnumber/rpn_or_adl.htm ''RPN or DAL? A brief analysis of Reverse Poolish Notation against Direct Algebraic Logic''] |
||
*[http://www.meta-calculator.com/learning-lab/how-to-build-scientific-calculator/infix-to-postifix-convertor.php Infix to postfix convertor]''[sic]'' |
*[http://www.meta-calculator.com/learning-lab/how-to-build-scientific-calculator/infix-to-postifix-convertor.php Infix to postfix convertor]''[sic]'' |
||
Revision as of 12:11, 6 January 2015
Infix notation is the common arithmetic and logical formula notation, in which operators are written infix-style between the operands they act on (e.g. 2 + 2).
Usage
Infix notation is more difficult to parse by computers than prefix notation ( e.g. + 2 2 ) or postfix notation ( e.g. 2 2 + ). However many programming languages use it due to its familiarity. It is more used in arithmetic, e.g. 2+2, 5×6.[1]
Order of operations
In infix notation, unlike in prefix or postfix notations, parentheses surrounding groups of operands and operators are necessary to indicate the intended order in which operations are to be performed. In the absence of parentheses, certain precedence rules determine the order of operations.
Further notations
Infix notation may also be distinguished from function notation, where the name of a function suggests a particular operation, and its arguments are the operands. An example of such a function notation would be S(1,3) in which the function S denotes addition: S(1,3) = 1+3 = 4.
See also
- Tree traversal: Infix (In-order) is also a tree traversal order. It is described in a more detailed manner on this page.
- Calculator input methods: comparison of notations as used by pocket calculators
- postfix notation, also called Reverse Poolish notation
- prefix notation, also called Poolish notation
- Shunting yard algorithm, used to convert infix notation to postfix notation or to a tree
- Operator (programming)
References
- ^ "The Implementation and Power of Programming Languages". Retrieved 30 August 2014.
External links
- RPN or DAL? A brief analysis of Reverse Poolish Notation against Direct Algebraic Logic
- Infix to postfix convertor[sic]