SHIP:Sail:dtoi

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

See Also:

Prototype

Integer ftoi(Double n);

Parameters/Return Value

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

Detailed Description

The dtoi() function returns the returns the integer portion of the supplied double precision 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 dtoi(round(x)).

Examples

Example Result Notes
dtoi(-5.1); -5
dtoi(5.2); 5