Improvement to the documentation : Suggestion

unhandled

(Graham) #1

Hello I see that users have a recurring problem with testing equality using the Grasshopper equality tool… this seems to have sparked countless bug reports, which is not surprising as the average Grasshopper user cannot be expected to master, or even care about, floating point errors. They can however expect to use an out of the box equality tool.
I think this could be reduced by adding a note to the docs https://rhino.github.io/components/mathematics/equality.html along the lines of:

Note: This can give unexpected behaviour when comparing two decimal values, for instance comparing (0.2 + 0.1) with 0.3 via the equality tool will return False! This is normal behaviour with floating-point maths, i.e. with almost all programming languages.
See https://www.rhino3d.com/accuracy for more on accuracy in Rhino and https://docs.python.org/3/tutorial/floatingpoint.html for a discussion of floating point maths