Attention
IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.
TRUNC¶
Truncates a real (floating-point) value toward zero, removing the fractional part and returning an integer.
IEC 61131-3 |
Section 2.5.1.5.2 |
Support |
Supported |
Signatures¶
# |
Input (IN) |
Return Type |
Support |
|---|---|---|---|
1 |
|
|
Supported |
2 |
|
|
Supported |
3 |
|
|
Supported |
4 |
|
|
Supported |
5 |
|
|
Supported |
6 |
|
|
Supported |
7 |
|
|
Supported |
8 |
|
|
Supported |
Description¶
TRUNC removes the fractional part of a real number, truncating toward
zero. This means positive values are rounded down and negative values
are rounded up (toward zero).
TRUNC(3.7)returns3TRUNC(-3.7)returns-3TRUNC(0.9)returns0
The return type is determined by the variable being assigned to.
Example¶
See Also¶
Type Conversions — explicit type conversion functions
ABS — absolute value