Difference between revisions of "SHIP:Sail:abs"

From Serious Documentation
Jump to: navigation, search
Line 6: Line 6:
 
== min ==
 
== min ==
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|min}}||{{DataType|Integer}}/{{DataType|Float}}||2+||Gets the minimum value of two or more numbers</onlyinclude>
+
|{{SailFunc|min}}||{{DataType|Integer}}/{{DataType|Float}}||2+||Gets the absolute value of a number</onlyinclude>
 
|}
 
|}
  
 
== Prototype ==
 
== Prototype ==
<code>{{DataType|Integer}} min({{DataType|Integer}} n1, {{DataType|Integer}} n2);</code>
+
<code>{{DataType|Integer}} abs({{DataType|Integer}} number);</code>
 
 
<code>{{DataType|Integer}} min({{DataType|Integer}} n1, {{DataType|Integer}} n2, {{DataType|Integer}} n3);</code>
 
  
<code>{{DataType|Float}} min({{DataType|Integer}}/{{DataType|Float}} n1, {{DataType|Integer}}/{{DataType|Float}} n2);</code>
+
<code>{{DataType|Float}} abs({{DataType|Float}} number);</code>
  
<code>{{DataType|Float}} min({{DataType|Integer}}/{{DataType|Float}} n1, {{DataType|Integer}}/{{DataType|Float}} n2, {{DataType|Integer}}/{{DataType|Float}} n3);</code>
 
  
 
=== Parameters/Return Value ===
 
=== Parameters/Return Value ===
Line 24: Line 21:
 
! scope="col" style="text-align:left" | Description
 
! scope="col" style="text-align:left" | Description
 
|-
 
|-
|n1||{{DataType|Integer}}/{{DataType|Float}}||The first of a set of numbers to find the minimum of
+
|number||{{DataType|Integer}}/{{DataType|Float}}||The number to find the absolute value of
|-
 
|n2||{{DataType|Integer}}/{{DataType|Float}}||The second of a set of numbers to find the minimum of
 
|-
 
|n3||{{DataType|Integer}}/{{DataType|Float}}||The third of a set of numbers to find the minimum of
 
 
|-
 
|-
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | {{DataType|Integer}}/{{DataType|Float}}
 
! scope="col" style="text-align:left" | {{DataType|Integer}}/{{DataType|Float}}
! scope="col" style="text-align:left" | the minimum of the supplied numbers; if any parameter is a {{DataType|Float}}, the result will be a {{DataType|Float}}
+
! scope="col" style="text-align:left" | the absolute value of the supplied number
|}
 
 
 
== Detailed Description ==
 
 
 
The <code>min()</code> function returns the minimum value of the set of specified numbers.
 
 
 
== Examples ==
 
{| class="wikitable" style="margin: 1em 1em;"
 
! scope="col" style="text-align:left" | Example
 
! scope="col" style="text-align:left" | Result
 
! scope="col" style="text-align:left" | Notes
 
|-
 
|<code>min(-5,-6);</code> || -6 ||
 
|-
 
|<code>min(-5, 2, 12);</code> || -5 ||
 
|-
 
|<code>min(0, 6, 5);</code> || 0 ||
 
|}
 
 
 
 
 
*[[SHIP:Sail:min|min()]], [[SHIP:Sail:max|max()]]
 
 
 
== abs ==
 
Gets the absolute value of a number.
 
 
 
== Prototype ==
 
<code>{{DataType|Integer}} abs({{DataType|Integer}} number);</code>
 
 
 
=== Parameters/Return Value ===
 
{| class="wikitable" style="margin: 1em 1em;"
 
! scope="col" style="text-align:left" | Parameter
 
! scope="col" style="text-align:left" | Data Type
 
! scope="col" style="text-align:left" | Description
 
|-
 
|number||{{DataType|Integer}}||The number to take the absolute value of
 
|-
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | {{DataType|Integer}}
 
! scope="col" style="text-align:left" | the absolute value of "number"
 
 
|}
 
|}
 
 
== Detailed Description ==
 
== Detailed Description ==
 
 
The <code>abs(number)</code> function returns the absolute value of the specified number.
 
The <code>abs(number)</code> function returns the absolute value of the specified number.
 
 
== Examples ==
 
== Examples ==
 
{| class="wikitable" style="margin: 1em 1em;"  
 
{| class="wikitable" style="margin: 1em 1em;"  

Revision as of 05:45, 22 June 2014

See Also:

min

Function Returns Introduced Description
min Integer/Float 2+ Gets the absolute value of a number

Prototype

Integer abs(Integer number);

Float abs(Float number);


Parameters/Return Value

Parameter Data Type Description
number Integer/Float The number to find the absolute value of
Return Integer/Float the absolute value of the supplied number

Detailed Description

The abs(number) function returns the absolute value of the specified number.

Examples

Example Result Notes
abs(-5); 5
abs(0); 0
abs(6); 6