Difference between revisions of "SHIP:Sail:min"

From Serious Documentation
Jump to: navigation, search
(Prototype)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
See Also:
+
{{SailFuncTableStart|}}<onlyinclude>
*[[SHIP:Sail|SHIP Sail Home]]
+
|{{SailFunc|min}}||{{DataType|Integer}}/{{DataType|Float}}||style="text-align:center;"|v4.0||Gets the minimum value of two or more numbers</onlyinclude>
*[[SHIP:Sail:Functions|SHIP Sail Function Home]]
 
*[[SHIP:Sail:abs|abs()]], [[SHIP:Sail:max|max()]]
 
== min ==
 
<onlyinclude>{{SailFuncTableStart|}}
 
|{{SailFunc|min}}||{{DataType|Integer}}||2+||Gets the minimum value of two or more numbers</onlyinclude>
 
 
|}
 
|}
 
+
The ability to use {{DataType|Float}}s with 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|abs}}, {{SailFunc|ceil}}, {{SailFunc|floor}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|round}}
 
== Prototype ==
 
== Prototype ==
<code>{{DataType|Integer}} min({{DataType|Integer}} n1, {{DataType|Integer}} n2);</code>
+
<code>{{DataType|Integer}} {{SailFunc|min}}({{DataType|Integer}} n1, {{DataType|Integer}} n2);</code>
  
<code>{{DataType|Integer}} min({{DataType|Integer}} n1, {{DataType|Integer}} n2, {{DataType|Integer}} n3);</code>
+
<code>{{DataType|Integer}} {{SailFunc|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}} {{SailFunc|min}}({{DataType|Integer}}/{{DataType|Float}} n1, {{DataType|Integer}}/{{DataType|Float}} n2);</code>
  
<code>{{DataType|Float}} min({{DataType|Integer}}/{{DataType|Float}} n1, {{DataType|Integer}}/{{DataType|Float}} n2, {{DataType|Integer}}/{{DataType|Float}} n3);</code>
+
<code>{{DataType|Float}} {{SailFunc|min}}({{DataType|Integer}}/{{DataType|Float}} n1, {{DataType|Integer}}/{{DataType|Float}} n2, {{DataType|Integer}}/{{DataType|Float}} n3);</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 34: Line 34:
 
! 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 minimum of the supplied numbers; if any parameter is a {{DataType|Float}}, the result will be a {{DataType|Float}}
 
|}
 
|}
 
 
== Detailed Description ==
 
== Detailed Description ==
 
+
The <code>{{SailFunc|min}}()</code> function returns the minimum value of the set of specified numbers.
The <code>min()</code> function returns the minimum value of the set of specified numbers.
 
 
 
 
== Examples ==
 
== Examples ==
 
{| class="wikitable" style="margin: 1em 1em;"  
 
{| class="wikitable" style="margin: 1em 1em;"  
Line 45: Line 42:
 
! scope="col" style="text-align:left" | Notes
 
! scope="col" style="text-align:left" | Notes
 
|-
 
|-
|<code>min(-5,-6);</code> || -6 ||
+
|<code>{{SailFunc|min}}(-5,-6);</code> || -6 ||
 
|-
 
|-
|<code>min(-5, 2, 12);</code> || -5 ||
+
|<code>{{SailFunc|min}}(-5, 2, 12);</code> || -5 ||
 
|-
 
|-
|<code>min(0, 6, 5);</code> || 0 ||
+
|<code>{{SailFunc|min}}(0, 6, 5);</code> || 0 ||
 
|}
 
|}
 +
 +
[[Category:Numeric Functions]]

Latest revision as of 15:16, 10 October 2016

Function Returns Introduced Description
min Integer/Float v4.0 Gets the minimum value of two or more numbers

The ability to use Floats with this function was introduced in SHIP Version 5.0.

See Also:

Prototype

Integer min(Integer n1, Integer n2);

Integer min(Integer n1, Integer n2, Integer n3);

Float min(Integer/Float n1, Integer/Float n2);

Float min(Integer/Float n1, Integer/Float n2, Integer/Float n3);

Parameters/Return Value

Parameter Data Type Description
n1 Integer/Float The first of a set of numbers to find the minimum of
n2 Integer/Float The second of a set of numbers to find the minimum of
n3 Integer/Float The third of a set of numbers to find the minimum of
Return Integer/Float the minimum of the supplied numbers; if any parameter is a Float, the result will be a Float

Detailed Description

The min() function returns the minimum value of the set of specified numbers.

Examples

Example Result Notes
min(-5,-6); -6
min(-5, 2, 12); -5
min(0, 6, 5); 0