algorithmic modeling for Rhino
Each of the test components (Greater/Less than or equality) seem to produce erroneous results unless the values are filtered by a notes panel.
I think the result should be TRUE when zero is tested for equality against zero no matter where the zeros are coming from.
If this isn't a bug, would someone please enlighten me as to why these tests produce different results.
Grasshopper Build 0.9.0076
Tags:
Hi there,
it is not realy a bug.
Numbers in computers have a limited ammount of precission. I don't want to go into detail about that -> check wikipedia for float / double...
In Grasshopper you can specify the display precission of numbers under preferences. When you connect a number to a panel it is acctualy converted into a string with that precission. e.g.:
0.000000000000000000001 will be represented as 0.0 string in the panel but of course it is not equal to 0.
But as you convert it to a String in the panel and than convert it to a number for comparision again the string 0.0 will be converted to the number 0.0 and all of a sudden 0.000000000000000000001 equals 0.0...
So what acutally happens through the panel is a loss in precission.
The best way to test equality on doubles is to ask if the Absolute Value of |A-B| < tolerance value. If true they are equal(enough) if false they are not equal(enough) .
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by