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
- We may assume that Calc does it the same way as Excel does it - simply being forced into “compatibility”.
- 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.
- Afaik Excel treats
Boolean
as a third data type along withstring
andnumber
. Calc treatsBoolean
(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 whereBoolean
should be expected will be interpreted as TRUE.
=AND(TRUE; -PI())
returns TRUE e.g. - Nothing said in the linked page about how strings supposed to represent dates are treated. Sloppy as usual? Surely.
- 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. - 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