Mingle Card: 2163
Mathjs handles precedence differently than Salesforce does. This is causing different outcomes for formula evaluation in Salesforce and Mobile:
Apex uses the following operator precedence rules:
| | |
|-|-|
Precedence|
Operators|
Description|
1|
{} () ++ --|
Grouping and prefix increments and decrements|
2|
! -x +x (type) new|
Unary negation, type cast and object creation|
3|
\* /|
Multiplication and division|
4|
\+ -|
Addition and subtraction|
5|
< <= > >= instanceof|
Greater-than and less-than comparisons, reference tests|
6|
\== !=|
Comparisons: equal and not-equal|
7|
&&|
Logical AND|
8|
|||
Logical OR|
9|
\= += -= \*= /= &=|
Assignment operators|
Currently mathjs puts logical operators (&& and ||) before comparisons (greater than and equality).
Mingle Card: 2163 Mathjs handles precedence differently than Salesforce does. This is causing different outcomes for formula evaluation in Salesforce and Mobile:
Apex uses the following operator precedence rules:
Currently mathjs puts logical operators (&& and ||) before comparisons (greater than and equality).
See: https://github.com/pixel9/mathjs/pull/5