More actions
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
<includeonly>{{ | <includeonly>{{if:{{{1|}}}|{{ifexpr:({{{1}}})>=0|{{expr:({{{1}}})}}|{{expr:-({{{1}}})}}}}|}}</includeonly><noinclude>{{Template documentation}} | ||
This template evaluates its numeric parameter and returns its [[absolute value]]. If the parameter is empty or missing, it returns an empty string. The parameter may also be a numeric expression that will be evaluated before testing its sign. | This template evaluates its numeric parameter and returns its [[absolute value]]. If the parameter is empty or missing, it returns an empty string. The parameter may also be a numeric expression that will be evaluated before testing its sign. | ||
Revision as of 23:52, 10 July 2006
Template:Template documentation This template evaluates its numeric parameter and returns its absolute value. If the parameter is empty or missing, it returns an empty string. The parameter may also be a numeric expression that will be evaluated before testing its sign.
- Syntax:
- {{Abs|value}}
- Examples with a simple number:
- {{Abs|100}} = Template:If:100.
- {{Abs|0.1}} = Template:If:0.1.
- {{Abs|0}} = Template:If:0.
- {{Abs|-0.1}} = Template:If:-0.1.
- {{Abs|-100}} = Template:If:-100.
- Examples where the parameter is evaluated:
- {{Abs|01}} = Template:If:01.
- {{Abs|00}} = Template:If:00.
- {{Abs|0.}} = Template:If:0..
- {{Abs|0.0}} = Template:If:0.0.
- {{Abs|-0}} = Template:If:-0.
- {{Abs|3-4}} = Template:If:3-4.
- {{Abs|-4*2}} = Template:If:-4*2.
- Examples with a empty (or missing) parameter:
- {{Abs|}} = Template:If:.
- {{Abs}} = Template:If:.