absolutevalue: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) m (Macros:Functions:absolutevalue moved to absolutevalue) |
Verisimilar (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name= | |name=absolutevalue | ||
|description=Returns the absolute value of a number. The absolute value of a number is the number without the sign. | |description=Returns the absolute value of a number. The absolute value of a number is the number without the sign. | ||
|usage= | |usage= | ||
<source lang="mtmacro" line> | |||
[h: val = absolutevalue(num)] | |||
</source> | |||
You can use the following shorthand for this function: | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: val = abs(num)] | [h: val = abs(num)] | ||
</source> | </source> | ||
|examples= | |examples= | ||
====Negative Number==== | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: | [r: absolutevalue(-3)] | ||
</source> | </source> | ||
Returns 3 | Returns:<source lang="mtmacro" line start=2>3</source> | ||
====Positive Number==== | |||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[r: abs(4)] | [r: abs(4)] | ||
</source> | </source> | ||
Returns 4. | Returns:<source lang="mtmacro" line start=2>4</source> | ||
====Decimal Number==== | |||
<source lang="mtmacro" line> | |||
[r: abs(3.4)] | |||
</source> | |||
Returns:<source lang="mtmacro" line start=2>3.4</source> | |||
}} | }} | ||
[[Category:Mathematical Function]] | [[Category:Mathematical Function]] |
Revision as of 22:05, 6 March 2009
absolutevalue() Function
Returns the absolute value of a number. The absolute value of a number is the number without the sign.
Usage
[h: val = absolutevalue(num)]
You can use the following shorthand for this function:
[h: val = abs(num)]
Examples
====Negative Number====
Returns:
Returns:
Returns:
[r: absolutevalue(-3)]
3
Positive Number
[r: abs(4)]
4
Decimal Number
[r: abs(3.4)]
3.4