Math( ) Performs mathematical operations and returns the result

 

    Math(returnvar,number1 operator number2)

 

Performs a floating-point calculation on number1 to number2, and assigns the result to the variable named returnvar. Valid operators are +, -, /, *, %, <, >, >=, <=, and ==, and they behave as their C equivalents.

Always returns 0.

    ; add two numbers, and say the result
    exten => 123,1,Math(SUM,2+2)
    exten => 123,2,SayNumber(${SUM})

    ; subtract two numbers, and say the difference
    exten => 124,1,Math(DIFFERENCE,5-3)
    exten => 124,2,SayNumber(${DIFFERENCE})