You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,9 @@
2
2
3
3
All notable changes to **antlr-calculator** are documented here.
4
4
5
+
## v2.2.0:
6
+
- Added support for `Min` and `Max` formulas
7
+
5
8
## v2.1.0:
6
9
- The calculator now supports trailing comments in a formula, separated by a semicolon `;` at the end of the actual formula input. For example, `1 + 2; Hello World!` now just evaluates `1 + 2` and ignores everything after the semicolon `;`
|`MAX '(' expression (';' expression)* ')'`| Maximum |
100
+
|`PI '()'?`| Mathematical constant pi = 3,141593 |
101
+
|`expression E+ expression`| Exponent, e.g. 10e+43 |
102
+
|`expression E- expression`| Inverted Exponent, e.g. 10e-43 |
103
+
|`EULER`| Mathematical constant e = 2,718282 |
104
+
|`'-' expression`| Unary minus sign (negative numbers) |
105
+
|`'+' expression`| Unary plus sign (positive numbers) |
106
+
|`'(' expression ')' expression`| Expressions without multiplication sign, e.g. `2(3)` -> `2*(3)`|
107
+
|`expression '(' expression ')'`| Expressions without multiplication sign, e.g. `2(3)` -> `2*(3)`|
108
108
109
109
_expression_ may be any expression as functions can be nested. Example: `DEG(2*PI)` or `LOG(10^3)`.
110
110
@@ -127,15 +127,13 @@ The calculator can be called with an overload that accepts a callback function f
127
127
Here, `#Z4` is a _substitution_, which is a placeholder that can be externally supplied. Let's say you want to resolve `#Z4` to the value three, you could make this simple call:
128
128
129
129
```typescript
130
-
const formula ="1,2*#Z4+3";
131
-
const result =Calculator.calculate(formula, substitution=>
132
-
{
133
-
if (substitution==="#Z4")
134
-
{
135
-
return3;
136
-
}
137
-
138
-
returnnull;
130
+
const formula ='1,2*#Z4+3';
131
+
const result =Calculator.calculate(formula, (substitution) => {
0 commit comments