Skip to main content
8-Gravel
Dec 13, 2023 6:45 AM UTC
Question

False alarm triggering and misdata in dababase due to loss of precision of floating-point type data

Dears,

     as screenshoots below, when a simulated float transferred from kepware to thingworx, 1.2 turns to 1.2000000476837158, so a false alarm triggered. Misdata logged in influxdb as well.

  • a simulated float which is 1.2 on kepware

20231213-143539.jpg

  • but on thingworx that turns to 1.2000000476837158

20231213-143723.jpg

alarm triggered when property is above 1.2

20231213-143854.jpg

  • So a false alarm triggered

20231213-144003.jpg

 

I can't change data restricted to external audit, what can I do to modify the data to the correct.

9 replies

Rocko
19-Tanzanite
Dec 14, 2023 3:10 PM UTC

Have you made sure that the value on Kepware really is 1.2 and not 1.2000000476837158 just being displayed as 1.2 in the Quick Client?

 

Translate
LeoChen8-GravelAuthor
8-Gravel
Dec 15, 2023 1:41 AM UTC

check property in qc, it is 1.2

20231215-093048.jpg

Or try to write 1.2 to this remote tag on thingworx, value also turns to 1.2000000476837158

  • write 1.2 to the tag
  • 20231215-093509.jpg

     Then value turns to 1.2000000476837158

20231215-093514.jpg

 floate points has the question.

Translate
Rocko
19-Tanzanite
Dec 15, 2023 12:50 PM UTC

This is actually expected behaviour and a consequence of using float type in Kepware instead of double.

Check this article for reference: https://www.ptc.com/en/support/article/CS341193

https://www.h-schmidt.net/FloatConverter/IEEE754.html

To work around this, use double in Kepware or transform your variable in TWX with toFixed.

Translate
Support
Dec 26, 2023 2:21 AM UTC

Hi @LeoChen ,

It appears that the previous reply by Rocko answers your question.  For the benefit of other Community Members who may have the same question, it would be great if you could designate it as the Accepted Solution.

In the event that this response did not answer your question, please post your current status so that we can continue to support.

Thanks for using the PTC Community!

Regards,

Tony

Translate