I know we can\'t compare 2 floating point values using ==. We can only compare they are within some interval of each other. I know
if(val == 0.512) >
if(val == 0.512)
You can compare to zero if you assigned that variable zero. If you get zero from eg. a subtraction you can still get a very small number close to zero. eg.: 0.1-0.1 may evalute to something like 1e-9.