Logic Machine Forum
set value 5000 on float16 becomes 4999.68 - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: set value 5000 on float16 becomes 4999.68 (/showthread.php?tid=3530)



set value 5000 on float16 becomes 4999.68 - spyder - 27.08.2021

Can you help?

I defined a group object of type float16 (09. 2 byte floating point).

When I set the value (manually or via /cgi-bin/scada-remote/request.cgi) to 5000, I get 4999.68.

There are no event scripts attached to the group object.

I am running on:
HW: Reactor v2 (i.MX28)
SW: 20200720

What am I doing wrong?


RE: set value 5000 on float16 becomes 4999.68 - admin - 27.08.2021

float16 has limited precision so you can't get 5000 precisely. If possible use float32 or int16.


RE: set value 5000 on float16 becomes 4999.68 - spyder - 28.08.2021

(27.08.2021, 12:20)admin Wrote: float16 has limited precision so you can't get 5000 precisely. If possible use float32 or int16.

ok, I understand - thanks!