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.
Log in to post a comment.