Atomic operators: (, )
Unary operators: !, not, -, ~ (bitwise NOT)
Exponentiation operator: (the original author omitted this and listed bitwise operators instead: &, |, ^ (XOR), <<, >>)
Multiplicative operators: *, /, %
Additive operators: +, –
Relational operators: =, ==, !=, <>, <, <=, >, >=
Logical operators: or, ||, and, &&
Remember the spelling: use the exact capitalization shown. Function names are case-sensitive.
| Function | Description | Example | Example result |
|---|---|---|---|
| Abs | Returns the absolute value. | Abs(-1) | 1M |
| Acos | Returns the angle corresponding to a cosine value. | Acos(1) | 0d |
| Asin | – | – | d |
| Atan | – | – | d |
| Ceiling | Rounds up to the nearest integer. | Ceiling(1.5) | 2d |
| Cos | – | – | d |
| Exp | Returns e raised to the specified power. | Exp(0) | 1d |
| Floor | Rounds down to the nearest integer. | Floor(1.5) | 1d |
| IEEERemainder | Returns the remainder defined by IEEE 754. See the IEEE 754 standard for details. | IEEERemainder(3, 2) | -1d |
| Log | Returns the logarithm using the second argument as the base. | Log(1,10) | 0d |
| Log10 | Returns the base-10 logarithm. | Log10(1) | 0d |
| Max | – | Max(1,2) | 2 |
| Min | – | Min(1,2) | 1 |
| Pow | – | Pow(3,2) | 9d |
| Round | The second argument sets the number of decimal places. Round uses round-half-to-even. Midpoint rounding can be configured with EvaluateOption.RoundAwayFromZero when constructing Expression. | Round(3.222,2) | 3.22d |
| Sign | Returns the sign. | Sign(-10) | -1 |
| Sin | – | – | d |
| Sqrt | Returns the square root. | Sqrt(4) | 2d |
| Tan | – | – | d |
| Truncate | Returns the integer portion. | Truncate(1.7) | 1 |
Note: In the results, M represents the Decimal type and d represents the Double type.
Other general-purpose functions:
| Function | Description | Example | Result |
|---|---|---|---|
| in | Checks whether the first element matches any of the values that follow. | in(1 + 1, 1, 2, 3) | true |
| if | Works like expression ? a : b. Returns one of the last two arguments based on the evaluated expression. | if(3 % 2 = 1, ‘value is true’, ‘value is false’) | ‘value is true’ |
