Difference between revisions of "SHIP:Sail:round"

From Serious Documentation
Jump to: navigation, search
Line 3: Line 3:
 
|{{SailFunc|round}}||{{DataType|Integer}}||1||Gets the nearest integer to a number {{v5}}</onlyinclude>
 
|{{SailFunc|round}}||{{DataType|Integer}}||1||Gets the nearest integer to a number {{v5}}</onlyinclude>
 
|}
 
|}
This function was introduced in [[SHIP_Version_5|SHIP Version 5.0]].
+
This function was introduced in [[SHIP_Version_5|SHIP Version 5.0]] {{v5}}.
 
== See Also: ==
 
== See Also: ==
*[[SHIP:Sail|SHIP Sail Home]]
+
*[[SHIP:Sail|Sail Home]]
*[[SHIP:Sail:Functions|SHIP Sail Function Home]]
+
*[[SHIP:Sail:Functions|Sail Functions]]
*{{SailFunc|abs}}, {{SailFunc|ceil}}, {{SailFunc|floor}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|min}}, {{SailFunc|round}}
+
*[[SHIP:Sail:Functions|Sail Numeric Functions]]
 +
*{{SailFunc|abs}}, {{SailFunc|ceil}}, {{SailFunc|floor}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|min}}
 
== Prototype ==
 
== Prototype ==
 
<code>{{DataType|Integer}} {{SailFunc|round}}({{DataType|Float}} n);</code>
 
<code>{{DataType|Integer}} {{SailFunc|round}}({{DataType|Float}} n);</code>

Revision as of 08:22, 13 July 2014

Function Returns Introduced Description
round Integer 1 Gets the nearest integer to a number Badge SHIPv5.gif

This function was introduced in SHIP Version 5.0 Badge SHIPv5.gif.

See Also:

Prototype

Integer round(Float n);

Parameters/Return Value

Parameter Data Type Description
n Float the number to find the rounded value of
Return Integer the rounded value of the supplied number

Detailed Description

The round() function returns the nearest integer to a number.

Examples

Example Result Notes
round(-5.1f); -5
round(-5.5f); -6
round(5.2f); 5
round(5.5f); 6