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)
I would still recommend following the tolerance idiom and not compare to zero exactly.