Difference between revisions of "SHIP:Sail:dtol"

From Serious Documentation
Jump to: navigation, search
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|dtol}}||{{DataType|Long}}||style="text-align:center;"|v5.1.0||Casts a {{DataType|Double}} to a {{DataType|Long}} {{v5}}</onlyinclude>
+
|{{SailFunc|dtol}}||{{DataType|Long}}||style="text-align:center;"|v5.1.0||Casts a {{DataType|Double}} to a {{DataType|Long}}</onlyinclude>
 
|}
 
|}
 
== See Also: ==
 
== See Also: ==
Line 34: Line 34:
 
! scope="col" style="text-align:left" | Notes
 
! scope="col" style="text-align:left" | Notes
 
|-
 
|-
|<code>{{SailFunc|dtol}}(-5.1d);</code> || -5 ||
+
|<code>{{SailFunc|dtol}}(-5.1);</code> || -5 ||
 
|-
 
|-
|<code>{{SailFunc|dtol}}(5.2d);</code> || 5 ||
+
|<code>{{SailFunc|dtol}}(5.2);</code> || 5 ||
 
|}
 
|}
  
 
[[Category:Numeric Functions]]
 
[[Category:Numeric Functions]]

Latest revision as of 17:12, 13 October 2016

Function Returns Introduced Description
dtol Long v5.1.0 Casts a Double to a Long

See Also:

Prototype

Long dtol(Double n);

Parameters/Return Value

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

Detailed Description

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

Examples

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