TRUNC
Function Name |
TRUNC |
---|---|
Description |
Truncates the floating value of the input into a double integer value. The double integer value is used as the output. |
Arguments |
Input 1 {REAL or LREAL}. For more information on the data types for the inputs and outputs, see Data Type Hierarchy. |
Returns |
Output {DINT} |
Example:
Function Block Diagram - TRUNC:
In this example, the input of 5.75423 is provided by the CurrentValueFormatted property of a point. The TRUNC function truncates the value into a double integer value of 5.
ST Program - TRUNC:
The syntax for a TRUNC function in an ST Program is:
- Output := TRUNC (Input 1);
Where Output and Input 1 are defined as variables earlier in the ST program. The Input 1 variable represents a REAL or LREAL type of value (the output is the same type of value as Input 1).