Real To LReal Conversion Accuracy

Is there a way to improve conversion accuracy when doing REAL_TO_LREAL conversions?

Example:

lrTemp:=REAL_TO_LREAL(rTemp);

real variable, rTemp = 84.38, the long real lrTemp= 84.379997253417969.

Is there a way to make lrTemp also = 84.38?

Many thanks

Best reply by TR1

Thanks for the explanation.ย  In the end I decided for 2 decimal place accuracy and did following conversion in code to ensure value displayed same in Motion App:

HMI Real setpoint * 100...REAL_TO_DINT...DINT_TO_LREAL...LREAL/100.

View original
4 replies