Deprecated TRUNC and REAL_TO_INT

cwright
2019-03-11
2019-03-13
  • cwright - 2019-03-11

    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?

     
  • Lo5tNet - 2019-03-13

    Trunc - Removes anything after the decimal.
    Real_to_int - Rounds up if after decimal is >= 0.5.

     

Log in to post a comment.