Skip to content

snap7.util.get_real() delivers inaccurate value #371

Answered by swamper123
joerggm asked this question in Q&A
Discussion options

You must be logged in to vote

You haven't done something wrong. This is the nature of floating point numbers. (
Siemens said, you can be 6 digits accurate on a PLC.
Then you got snap7 and pyton-snap7 in between and the floatingpoint error exists.

Try out this in your pythonconsole:

>>> 1.2-1.0
0.19999999999999996
>>> 

For more infos about this error: read these python docs

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joerggm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants