Difference between revisions of "SHIP:Sail:ftol"

From Serious Documentation
Jump to: navigation, search
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|ftol}}||{{DataType|Long}}||style="text-align:center;"|v5.1.0||Casts a {{DataType|Float}} to a {{DataType|Long}} {{v5}}</onlyinclude>
+
|{{SailFunc|ftol}}||{{DataType|Long}}||style="text-align:center;"|v5.1.0||Casts a {{DataType|Float}} to a {{DataType|Long}}</onlyinclude>
 
|}
 
|}
 
== See Also: ==
 
== See Also: ==

Latest revision as of 17:34, 13 October 2016

Function Returns Introduced Description
ftol Long v5.1.0 Casts a Float to a Long

See Also:

Prototype

Long ftol(Float n);

Parameters/Return Value

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

Detailed Description

The ftol() 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 ftol(round(x)).

Examples

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