What is an arithmetic expression

Arithmetic expression

A arithmetic expression may numbers, opening and closing brackets ( [ { } ] )who have favourited Symbols for the four basic arithmetic operations + − * / and potentiating ^ and Standard functions (with arguments in brackets) included.

An arithmetic expression is subjected to a syntactic control. If it is free of errors, an attempt is made to determine the value of the expression, with further checks being carried out (use of illegal arguments for the standard functions, division by zero, risk of overflow, ...).

Examples of correct arithmetic expressions (upper and lower case letters are basically equivalent, spaces are ignored, PI is the "circle number" and is predefined as such):

  • 17 + 5 * 9.3

  • - 3 * sin (- 210)

  • PI / 2 + SQRT [1 + (cos (PI / 4)) ^ (3/2)]

The arguments of the trigonometric functions are expected in degrees.

Examples of incorrect arithmetic expressions:

  (two consecutive operation symbols)
  (Argument of a standard function must be bracketed)
  (Logarithm with negative argument)
  (Division with zero)
  (Operation leads to overflow, result is greater than 10307)