This shows you the differences between two versions of the page.
en:public:developer:template_system:tags:expression:calc [2012/11/15 22:37] admin [Attributes] |
en:public:developer:template_system:tags:expression:calc [2015/02/05 16:06] (current) svanderclock [<#Calc>] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== <#Calc> ===== | + | ====== <#Calc> ====== |
A parser, compiler and interpreter for mathematical expressions. It can handle normal arithmetics (includings powers wit ^) and builtin functions like sin(). | A parser, compiler and interpreter for mathematical expressions. It can handle normal arithmetics (includings powers wit ^) and builtin functions like sin(). | ||
Multiplication *, division / and modulo mod have the same precedence, and are evaluated left to right. | Multiplication *, division / and modulo mod have the same precedence, and are evaluated left to right. | ||
+ | **NOTE:** the input always use the '.' as decimalseparator. The output use the decimalseparator of the current language | ||
- | ==== Attributes ==== | ||
- | * **expression** - The expression to evaluate | + | ==== Parameters ==== |
+ | |||
+ | ^ Name ^ Mandatory ^ Description ^ | ||
+ | | <html><span style="color:#008000">Expression</span></html> | Yes | The expression to evaluate. The tags in the expression are always evaluated before the expression is calculated | | ||
==== Example ==== | ==== Example ==== | ||
<code> | <code> | ||
- | <#url_PageNumber> mod 10 = <#calc expression="<#url_PageNumber> mod 10"> | + | <#var name=MyNumber Value=100> |
+ | <#var name=MyNumber> mod 10 = <#calc expression="<#var name=MyNumber> mod 10"> | ||
+ | </code> | ||
+ | |||
+ | The above example will output: | ||
+ | |||
+ | <code> | ||
+ | 100 mod 10 = 10 | ||
</code> | </code> |