SHIP:Sail:ftoi

From Serious Documentation
Jump to: navigation, search
Function Returns Introduced Description
ftoi Integer v5.0 Casts a Float to an Integer

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