Difference between revisions of "SHIP:Sail:abs"

From Serious Documentation
Jump to: navigation, search
(min)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
See Also:
 
*[[SHIP:Sail|SHIP Sail Home]]
 
*[[SHIP:Sail:Functions|SHIP Sail Function Home]]
 
* {{SailFunc|min}}, {{SailFunc|max}}, {{SailFunc|round}}, {{SailFunc|ceil}}, {{SailFunc|floor}}, {{SailFunc|itof}}, {{SailFunc|ftoi}}
 
== min ==
 
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|abs}}||{{DataType|Integer}}/{{DataType|Float}}||2+||Gets the absolute value of a number</onlyinclude>
+
|{{SailFunc|abs}}||{{DataType|Integer}}/{{DataType|Float}}||style="text-align:center;"|v4.0||Gets the absolute value of a number</onlyinclude>
 
|}
 
|}
 
+
The {{DataType|Float}} form of this function was introduced in [[SHIP_Version_5|SHIP Version 5.0]].
 +
== See Also: ==
 +
*[[SHIP:Sail|Sail Home]]
 +
*[[SHIP:Sail:Functions|Sail Functions]]
 +
*[[SHIP:Sail:Numeric Functions|Sail Numeric Functions]]
 +
*{{SailFunc|ceil}}, {{SailFunc|floor}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|min}}, {{SailFunc|round}}
 
== Prototype ==
 
== Prototype ==
 
<code>{{DataType|Integer}} {{SailFunc|abs}}({{DataType|Integer}} number);</code>
 
<code>{{DataType|Integer}} {{SailFunc|abs}}({{DataType|Integer}} number);</code>
Line 14: Line 14:
 
<code>{{DataType|Float}} {{SailFunc|abs}}({{DataType|Float}} number);</code>
 
<code>{{DataType|Float}} {{SailFunc|abs}}({{DataType|Float}} number);</code>
  
 
+
== Parameters/Return Value ==
=== Parameters/Return Value ===
 
 
{| class="wikitable" style="margin: 1em 1em;"  
 
{| class="wikitable" style="margin: 1em 1em;"  
 
! scope="col" style="text-align:left" | Parameter
 
! scope="col" style="text-align:left" | Parameter
Line 29: Line 28:
 
== Detailed Description ==
 
== Detailed Description ==
 
The <code>{{SailFunc|abs}}(number)</code> function returns the absolute value of the specified number.
 
The <code>{{SailFunc|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;"  
Line 36: Line 34:
 
! scope="col" style="text-align:left" | Notes
 
! scope="col" style="text-align:left" | Notes
 
|-
 
|-
|<code>{{SailFunc|abs}}(-5);</code> || 5 ||
+
|<source lang="c">abs(-5);</source> || 5 ||
 
|-
 
|-
|<code>{{SailFunc|abs}}(0);</code> || 0 ||
+
|<source lang="c">abs(0);</source> || 0 ||
 
|-
 
|-
|<code>{{SailFunc|abs}}(6);</code> || 6 ||
+
|<source lang="c">abs(6);</source> || 6 ||
 
|}
 
|}
 +
 +
[[Category:Numeric Functions]]

Latest revision as of 14:36, 11 October 2016

Function Returns Introduced Description
abs Integer/Float v4.0 Gets the absolute value of a number

The Float form of this function was introduced in SHIP Version 5.0.

See Also:

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