math
Evaluates a mathamatical expression and saves the result into the assigned variable.
Some bitwise operators are also supported in ComScipt via the math command.
Bitwise operators include: BWAND(&), BWOR(|), XOR(^), LS(<<), RS(>>). Decimal values are used and returned with ComScript bitwise operators, but the operations are done at the binary level. For more information on bitwise operations vist the
bitwise Wikipedia page.
Attributes:
var: the name of the variable to store the result
- expression: the mathematical expression to be solved. The chart below list all supported math expressions.
Examples:
<math var="x" expression="5.555 * 11" />
<math var="y" expression="Round([x],1)" /> note: first value in parentheses is round the number of decimal place indicate by second number in parentheses.
<math var="z" expression="Log10([x]*Sin(1.5708))" /> note: the [ ] around the variable x and that all trigonometric functions use radians. x deg. * pi/180 = x radians
Bitwise
<math var="a" expression="5 BWOR 6" /> result: a=7
<math var="b" expression="5 BWAND 6" /> result: b=4
<math var="c" expression="8 LS 2" /> result: c=32 note: shifting 2 binary places to the left and filling in with 0s.