-
-
Notifications
You must be signed in to change notification settings - Fork 16
Math
Stef Heyenrath edited this page Apr 22, 2021
·
5 revisions
These helpers provide the ability to perform some calculations within a template.
- Math.Add / Math.Plus
- Math.Abs
- Math.Avg
- Math.Ceiling
- Math.Divide
- Math.Floor
- Math.Equal
- Math.GreaterThan
- Math.GreaterThanEqual
- Math.LessThan
- Math.LessThanEqual
- Math.NotEqual
- Math.Max
- Math.Min
- Math.Modulo
- Math.Multiply / Math.Times
- Math.Power
- Math.Round
- Math.Sign
- Math.Subtract / Math.Minus
- Math.Sqrt
Summary | Add two numbers |
Returns | Sum of inputs |
Remarks | |
Parameters | |
input1 | First input |
input2 | Second input |
Context
{
"a": 1,
"b": 2,
"c": 3
}
Usage
<strong>result:</strong>
{{Math.Add a b}}
{{Math.Add b c}}
{{Math.Add c 4}}
{{Math.Add 4 5}}
Returns
<strong>result:</strong>
3
5
7
9
Summary | Rounds input up to the nearest whole number |
Returns | Ceiling of input |
Remarks | |
Parameters | |
input | input |
Context
{
"a": 1.23,
"b": 2.45,
"c": 3.67
}
Usage
<strong>result:</strong>
{{Math.Ceiling a}}
{{Math.Ceiling b}}
{{Math.Ceiling c}}
{{Math.Ceiling 4.89}}
Returns
<strong>result:</strong>
2
3
4
5
Summary | Divide first input by second input |
Returns | Result of first input divided by second input |
Remarks | |
Parameters | |
input1 | First input |
input2 | Second input |
Context
{
"a": 1,
"b": 2,
"c": 3
}
Usage
<strong>result:</strong>
{{Math.Divide a b}}
{{Math.Divide b c}}
{{Math.Divide c 4}}
{{Math.Divide 4 5}}
Returns
<strong>result:</strong>
0.5
0.666666666666667
0.75
0.8
Summary | Rounds input down to the nearest whole number |
Returns | Floor of input |
Remarks | |
Parameters | |
input | input |
Context
{
"a": 1.23,
"b": 2.45,
"c": 3.67
}
Usage
<strong>result:</strong>
{{Math.Floor a}}
{{Math.Floor b}}
{{Math.Floor c}}
{{Math.Floor 4.89}}
Returns
<strong>result:</strong>
1
2
3
4
Summary | Modulus of first over second input |
Returns | Result of modulus of first input over second input |
Remarks | |
Parameters | |
input1 | First input |
input2 | Second input |
Context
{
"a": 1,
"b": 2,
"c": 3
}
Usage
<strong>result:</strong>
{{Math.Mod a b}}
{{Math.Mod b c}}
{{Math.Mod c 4}}
{{Math.Mod 4 5}}
Returns
<strong>result:</strong>
1
2
3
4
Summary | Multiply first input by second input |
Returns | Result of multiplication of first input and second input |
Remarks | |
Parameters | |
input1 | First input |
input2 | Second input |
Context
{
"a": 1,
"b": 2,
"c": 3
}
Usage
<strong>result:</strong>
{{Math.Multiply a b}}
{{Math.Multiply b c}}
{{Math.Multiply c 4}}
{{Math.Multiply 4 5}}
Returns
<strong>result:</strong>
2
6
12
20
Summary | Rounds input to the nearest whole number |
Returns | Rounded input |
Remarks | Rounds depending on what side of the half the number falls on |
Parameters | |
input | input |
Context
{
"a": 1.23,
"b": 2.45,
"c": 3.67
}
Usage
<strong>result:</strong>
{{Math.Round a}}
{{Math.Round b}}
{{Math.Round c}}
{{Math.Round 4.89}}
Returns
<strong>result:</strong>
1
2
4
5
Summary | Subtract second input from first |
Returns | Result of subtracting the second input from first |
Remarks | |
Parameters | |
input1 | First input |
input2 | Second input |
Context
{
"a": 4,
"b": 3,
"c": 1
}
Usage
<strong>result:</strong>
{{Math.Subtract a b}}
{{Math.Subtract b c}}
{{Math.Subtract c 2}}
{{Math.Subtract 2 5}}
Returns
<strong>result:</strong>
1
2
-1
-3
-
Helpers
-
Additional Helpers
-
Development