Real Value in debug mode

Hi I have a little strange behavior when debug on real values. When the value is 0.0 it shows as 0.0, but when the value is 0.01 the value is showed as 9.999998E-E003 (i know it’s almost the same as 0.01)

When the value is 0.02->higer it still shows like 0.02, 0.03 and so on.

Why is 0.01 showed different? Hour1Hour2 options

Hi Emil, I think it has something to do with this: https://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/ Someone smarter than me will need to explain exactly how this applies in the cases you mention, if necessary. ================= EDIT: The other half of the story is why PLCnext Engineer doesn’t show 0.00 for all floating point numbers less than 0.01. I suppose this is a design decision, otherwise all floating point numbers below 0.01 (in this case) would appear as zero, which probably would be worse than switching to scientific notation. Here are a few examples of this behaviour: 2020 03 30 20 08 26 ~ Martin.

The discussion below is for the case of real values displayed to 2 places. It actually appears that PLCnext Engineer rounds real values to 2 decimal places, rather than truncating, so 0.019 appears as 0.02 (not 0.01) in debug mode. So, instead of switching to scientific notation for real values less than 0.01, it probably would be more consistent if PLCnext Engineer switched to scientific notation for values below 0.005 (since values 0.005-0.00999… should be rounded up to 0.01). However, this does not happen, and the switch to scientific notation happens for values below 0.01. Not a big deal - it would switch to scientific notation below a certain value anyway. I don’t think this is worth a bug report or a feature request, but I hope this explains what you are seeing. ~ Martin.

moved to PLCnext Engineer category

OK, that makes sense. Thanks Martin