How to round a REAL?

Hello,

I need to apply a factor and an offset to a value using the following code:


The problem is that the resulting REAL ("rResult") always ends up with extra decimals:

In this case I would like to get rid of the extra 0.0000002 in "rResult" and get:
rResult = 123.4

I know that this is caused by how floating point numbers are represented in binary, but is there any native function for rounding operations in CODESYS that might solve this?

Thanks!

5 replies