Operator precedence in calc - any overview?

Is there a comprehensive overview / documentation for the order in which calc sorts operators in formulas?
A bit like this one Operator precedence in Excel
It is perhaps the same order that Calc do - Perhaps downright a globally adopted rule?

1 Like
  1. We may assume that Calc does it the same way as Excel does it - simply being forced into “compatibility”.
  2. It’s a bad idea to define operator precedence across different data types where automatic conversion is required, without explicitly specifying the type of the result. Use parentheses and conversion functions to clarify/disambiguate.
  3. Afaik Excel treats Boolean as a third data type along with string and number. Calc treats Boolean (logical) results and input as numbers basically and only adds an additional format for the display. Any number different from 0 put in a position where Boolean should be expected will be interpreted as TRUE.
    =AND(TRUE; -PI()) returns TRUE e.g.
  4. Nothing said in the linked page about how strings supposed to represent dates are treated. Sloppy as usual? Surely.
  5. The reasonable preference rules for arithmetic expressions you learned in school: Sign or ChangeSign (or "+" denoting identity) before exponentiation before operations of second order (multiplication or division) before operations of first order (addition or subtraction). Even MS will respect that.
  6. GOLDEN RULE: Wherever there is the slightest doubt, disambiguate with the help of parentheses and/or conversion functions.

The definition is in the ODF OpenFormula (ODFF) standard:
Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format

2 Likes