VS:Trunc
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Truncates the decimal portion of the specified REAL number, returning the result as a LONGINT value.
Note that direct assignment of a REAL to a LONGINT will result in rounding the REAL to the nearest LONGINT, whereas Trunc always rounds down (if the number is positive).
FUNCTION Trunc(
v :REAL) : LONGINT;
def vs.Trunc(v): return LONGINT
Parameters
v REAL Real value to truncate.
Example
VectorScript
Trunc(235.04); { returns 235 } Trunc(235.94); { returns 235 } Trunc(0.94); { returns 0 }
Python
Version
Availability: from All Versions