Content
Usage notes:
Certain formulation can cause unexpected behaviour. As examples: division by zero division by negative number, example: 48/-7 using text or char except for callback for operand using another operator (<, >, =,etc)
- Supported operators: +, -, *, /
- Arguments can't start and end with operator (+, -, *, / )
- Two operators one after the other will cause an error
- The priority for operator is still working, which mean that the multiplication and division will be executed first followed by addition and substraction
- Parentheses ((, )) can't be used to change operator priority.
- Integer division method will be used for division.
- Callback don't work with float numbers
Here are some common operations:
Argument | Result |
---|---|
4 | 4 |
1+2 | 3 |
1-2 | -1 |
$(max_registrations)-1 | 11 (note: can vary depending on phone type) |
2*3 | 6 |
0*4 | 0 |
4/2 | 2 |
10/3 | 3 |
47/7 | 6 |
0/4 | 0 |
1+3*4 | 13 |
1-10/5 | -1 |
109/10/4 | 2 |
Example code:
<SnomIPPhoneText> <Text> 4=$(math_eval:4)<br /> 1+2=$(math_eval:1+2)<br /> 1-2=$(math_eval:1-2)<br /> max_registrations-1=$(math_eval:$(max_registrations)-1)<br /> 2*3=$(math_eval:2*3)<br /> 0*4=$(math_eval:0*4)<br /> 4/2=$(math_eval:4/2)<br /> 10/3=$(math_eval:10/3)<br /> 47/7=$(math_eval:47/7)<br /> 0/4=$(math_eval:0/4)<br /> 1+3*4=$(math_eval:1+3*4)<br /> 1-10/5=$(math_eval:1-10/5)<br /> 109/10/4=$(math_eval:109/10/4)<br /> </Text> </SnomIPPhoneText>
Result:
Further Information
Related articles