4D v14.3

Trunc

Home

 
4D v14.3
Trunc

Trunc 


 

Trunc ( number ; places ) -> Function result 
Parameter Type   Description
number  Real in Number to be truncated
places  Longint in Number of decimal places used for truncating
Function result  Real in Number with its decimal part truncated to the number of decimal places specified by Places

Trunc returns number with its decimal part truncated to the number of decimal places specified by places. Trunc always truncates toward negative infinity.

If places is positive, number is truncated to places decimal places. If places is negative, number is truncated on the left of the decimal point.

Example  

The following example illustrates how Trunc works with different arguments. Each line assigns a number to the vlResult variable. The comments describe the results:

 vlResult:=Trunc(216.897;1) ` vlResult gets 216.8
 vlResult:=Trunc(216.897;-1) ` vlResult gets 210
 vlResult:=Trunc(-216.897;1) ` vlResult gets –216.9
 vlResult:=Trunc(-216.897;-1) ` vlResult gets –220

 
PROPERTIES 

Product: 4D
Theme: Math
Number: 95

 
HISTORY 

Created: < 4D v6

 
SEE ALSO 

Round

 
ARTICLE USAGE

4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)