Synopsis:
Performs Mathematical Functions
Description:
MATH(<number1><op><number 2>[,<type_of_result>])
Perform calculation on number 1 to number 2. Valid ops are:
+,-,/,*,%,<,>,>=,<=,==and behave as their C equivalents.
<type_of_result> – wanted type of result:
f, float – float(default)
i, int – integer,
h, hex – hex,
c, char – char
Max. value: 2147483647 (signed long)
% is the modulo operator
int cuts of all decimals (it does not perform any rounding)
Notes
MATH() can only perform a single operation per MATH statement.
Return value
Returns the resulting string.
Example
exten => s,1,Set(i=${MATH(123%16,int)})
sets var i=11 (modulo)