sesaparcours
    Preparing search index...

    Type Alias Precedence

    Precedence: number

    The precedence of an operator is a number that indicates the order in which operators are applied.

    For example, in 1 + 2 * 3, the * operator has a higher precedence than the + operator, so it is applied first.

    The precedence range from 0 to 1000. The larger the number, the higher the precedence, the more "binding" the operator is.

    Here are some rough ranges for the precedence:

    • 800: prefix and postfix operators: \lnot etc...
      • POSTFIX_PRECEDENCE = 810: !, '
    • 700: some arithmetic operators
      • EXPONENTIATION_PRECEDENCE = 700: ^
    • 600: some binary operators
      • DIVISION_PRECEDENCE = 600: \div
    • 500: not used
    • 400: not used
    • 300: some logic and arithmetic operators: \land, \lor, \times, etc...
      • MULTIPLICATION_PRECEDENCE = 390: \times
    • 200: arithmetic operators, inequalities:
      • ADDITION_PRECEDENCE = 275: + -
      • ARROW_PRECEDENCE = 270: \to \rightarrow
      • ASSIGNMENT_PRECEDENCE = 260: :=
      • COMPARISON_PRECEDENCE = 245: \lt \gt
      • 241: \leq
    • 100: not used
    • 0: ,, ;, etc...

    Some constants are defined below for common precedence values.

    Note: MathML defines some operator precedence, but it has some issues and inconsistencies. However, whenever possible we adopted the MathML precedence. See https://www.w3.org/TR/2009/WD-MathML3-20090924/appendixc.html

    For reference, the JavaScript operator precedence is documented here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence