I need to make a simple counter to increase a led light with every button click and then restart counter to 0.
The led works ok but when the counter node reaches 1, the equal node never returns TRUE
count node parameters:
STEP = 0.1
On equal node i’ve tested with 1, 1.0 and with 1.00 and never returns TRUE, if a change equal node for a greater node with value = 0.9 it works
Yes i supose that. But will be any kind of solution in future ? Basically if XOD will be used to teach students to program their robots, boards … this could be a problem.
They will see a watch node showing 1.00, and the equal not working with 1.00 too
Shouldn’t the students learn that the computer math is not perfect?
It will be quite hard to do anything with equal which will not lead to ambiguities in other scenarios. I’m thinking about a node like almost-equal which will take a tolerance (with a sane default) as its input. Will it solve the problem, what do you think?
That’s a very dangerous assumption. The system can’t be sure where the arguments came from and what tolerance is acceptable. Such algorithm will work in trivial cases but it will break many other cases.
Trying to find a balance between the reality of floating point and accessibility for a student’s mind… Perhaps, dropping the current equal for numbers in favor of one with tolerance = 1% (0.01) is not the worst idea.