Returns an integer by removing the fraction part of a float.
float
Syntax
int float.Truncate()
Returns
The int value produced by removing the fractional part of the float value.
int
Sample
floatSample.rfsvar a = 42.56; ... var b = -65.2; ... var q = a.Truncate(); var r = b.Truncate(); trace a, " truncated is ", q, " and ", b, " truncated is ", r;
floatSample.rfs
var a = 42.56; ... var b = -65.2; ... var q = a.Truncate(); var r = b.Truncate(); trace a, " truncated is ", q, " and ", b, " truncated is ", r;
a.Truncate()
b.Truncate()
42.56, " truncated is ", 42, " and ", -65.2, " truncated is ", -65
Figure 346. The trace message output of the above script
Related links
Search Highlighter (On/Off)