githubbob42 / mingle2github2

0 stars 1 forks source link

comparison operators should take precedence over logical operators #1931

Open githubbob42 opened 5 years ago

githubbob42 commented 5 years ago

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). 

See: https://github.com/pixel9/mathjs/pull/5

githubbob42 commented 5 years ago

Story: #1654 Make the MathJS library work more like Salesforce (Mingle)