Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
In PLCOpen's Coding Guidlines, section 5.28 says to avoid using deprecated features. Under Examples, it lists "Standard Function 'TRUNC.'" I assume that the preferred method at this point is to use a REAL_TO_INT conversion operator. Can someone elaborate on the differences, and why to use one over the other?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In PLCOpen's Coding Guidlines, section 5.28 says to avoid using deprecated features. Under Examples, it lists "Standard Function 'TRUNC.'" I assume that the preferred method at this point is to use a REAL_TO_INT conversion operator. Can someone elaborate on the differences, and why to use one over the other?
Trunc - Removes anything after the decimal.
Real_to_int - Rounds up if after decimal is >= 0.5.