Playing with [calc]
-
[calc]
does not always work as expected. Here is what I found:(Set) [set years]377[/set]. OK (displays nothing) (get): [get years]. OK. (displays 377) + [calc]years + 10[/calc]. OK - [calc]years - 10[/calc]. Does not work - [calc]years + -10[/calc]. Workaround * [calc]years * 10[/calc]. OK / [calc]years / 10[/calc]. OK % [calc]years % 10[/calc]. Does not work (mod) ^ [calc]years ^ 10[/calc]. OK mod [calc]years mod 10[/calc]. Does not work mod [calc]years mod(10)[/calc]. Does not work mod [calc]mod(years,10)[/calc]. OK (modulo)
Other built in functions:
‘sin’,’sinh’,’arcsin’,’asin’,’arcsinh’,’asinh’,
‘cos’,’cosh’,’arccos’,’acos’,’arccosh’,’acosh’,
‘tan’,’tanh’,’arctan’,’atan’,’arctanh’,’atanh’,
‘sqrt’,’abs’,’ln’,’log’,’exp’,’floor’,’ceil’.
ie.log(years)
will work.Other functions:
‘average’=>array(-1), ‘max’=>array(-1), ‘min’=>array(-1),
‘mod’=>array(2), ‘pi’=>array(0), ‘power’=>array(2),
’round’=>array(1, 2), ‘sum’=>array(-1), ‘rand_int’=>array(2),
‘rand_float’=>array(0), ‘format’=>array(-1)
The number in brackets is the number of parameters. -1 is any number.
e.g[calc]rand_int(min,max)[/calc]
will display a random integer between min and max.You can also use the constants: p() and exp(1).
- The topic ‘Playing with [calc]’ is closed to new replies.