TRUNC
Syntax
![]()
Command
Mandatory parameter Optional parameter Mandatory keyword Optional keyword |
TRUNC (<Value>, <Length>[, <Decimals>])
Description
Truncates the numeric <Value>. This means that digits are removed starting from the right side of the original value until the result value complies with the specified length and decimals. In difference with the ROUND function, the result value is never rounded upwards.
Diagram
Returned value type
Numeric
Parameters
Parameter | Description |
<Value> | Expression giving a numeric value |
<Length> | The length for the <Value> |
<Decimals> | The number of decimals for the <Value> |
Example
resultvalue1 := trunc (input1, 10, 1)
resultvalue2 := round (input1, 10, 1)
{ if input1 contains 15,65000 then:
resultvalue1 will get the value 15.6
resultvalue2 will get the value 15.7
}
resultvalue2 := round (input1, 10, 1)
{ if input1 contains 15,65000 then:
resultvalue1 will get the value 15.6
resultvalue2 will get the value 15.7
}