Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Abs: Difference between revisions

Template page
Shane (talk | contribs)
No edit summary
Shane (talk | contribs)
mNo edit summary
Line 1: Line 1:
<includeonly>{{if:{{{1|}}}|{{ifexpr:({{{1}}})>=0|{{expr:({{{1}}})}}|{{expr:-({{{1}}})}}}}|}}</includeonly><noinclude>
<includeonly>{{if:{{{1|}}}|{{ifexpr:({{{1}}})>=0|{{expr:({{{1}}})}}|{{expr:-({{{1}}})}}}}|}}</includeonly><noinclude>
This template evaluates its numeric parameter and returns its [[Wikipieda|absolute value|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 [[Wikipieda:absolute value|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<nowiki>:</nowiki>
; Syntax<nowiki>:</nowiki>

Revision as of 23:52, 10 July 2006

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:.