absolutevalue: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Redirecting to Macros:Functions:abs)
 
m (Conversion script moved page Absolutevalue to absolutevalue: Converting page titles to lowercase)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
#REDIRECT [[Macros:Functions:abs]]
{{Languages|absolutevalue}}
{{MacroFunction
|name=absolutevalue
|description=Returns the absolute value of a number. The absolute value of a number is the number without the sign.
 
|usage=
<syntaxhighlight lang="mtmacro" line>
[h: val = absolutevalue(num)]
</syntaxhighlight>
You can use the following shorthand for this function:
<syntaxhighlight lang="mtmacro" line>
[h: val = abs(num)]
</syntaxhighlight>
 
|examples=
====Negative Number====
<syntaxhighlight lang="mtmacro" line>
[r: absolutevalue(-3)]
</syntaxhighlight>
Returns:<syntaxhighlight lang="mtmacro" line start=2>3</syntaxhighlight>
 
 
====Positive Number====
<syntaxhighlight lang="mtmacro" line>
[r: abs(4)]
</syntaxhighlight>
Returns:<syntaxhighlight lang="mtmacro" line start=2>4</syntaxhighlight>
 
 
====Decimal Number====
<syntaxhighlight lang="mtmacro" line>
[r: abs(3.4)]
</syntaxhighlight>
Returns:<syntaxhighlight lang="mtmacro" line start=2>3.4</syntaxhighlight>
 
}}
[[Category:Mathematical Function]]
{{Languages|absolutevalue}}

Latest revision as of 22:53, 9 February 2023

Languages:  English  • 日本語  • 한국어


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====
[r: absolutevalue(-3)]
Returns:
3


Positive Number

[r: abs(4)]
Returns:
4


Decimal Number

[r: abs(3.4)]
Returns:
3.4

Languages:  English  • 日本語  • 한국어