Difference between revisions of "SHIP:Sail:ftoi"

From Serious Documentation
Jump to: navigation, search
Line 7: Line 7:
 
*[[SHIP:Sail|Sail Home]]
 
*[[SHIP:Sail|Sail Home]]
 
*[[SHIP:Sail:Functions|Sail Functions]]
 
*[[SHIP:Sail:Functions|Sail Functions]]
*[[SHIP:Sail:Functions|Sail Numeric Functions]]
+
*[[SHIP:Sail:Numeric Functions|Sail Numeric Functions]]
 
*{{SailFunc|abs}}, {{SailFunc|ceil}}, {{SailFunc|floor}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|min}}, {{SailFunc|round}}
 
*{{SailFunc|abs}}, {{SailFunc|ceil}}, {{SailFunc|floor}}, {{SailFunc|itof}}, {{SailFunc|max}}, {{SailFunc|min}}, {{SailFunc|round}}
 
== Prototype ==
 
== Prototype ==

Revision as of 08:23, 13 July 2014

Function Returns Introduced Description
ftoi Integer 1 Casts a Float to an Integer Badge SHIPv5.gif

This function was introduced in SHIP Version 5.0.

See Also:

Prototype

Integer ftoi(Float n);

Parameters/Return Value

Parameter Data Type Description
n Float the number to find the ceiling value of
Return Integer the integer portion of the supplied number

Detailed Description

The ftoi() function returns the returns the integer portion of the supplied floating point number. Note this is a truncating conversion (as in Java and C), not a rounding conversion. Often, you'll want to use rounding as well, for example ftoi(round(x)).

Examples

Example Result Notes
ftoi(-5.1f); -5
ftoi(5.2f); 5