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)
>
I don't think you can in general - the calculation that occurs in getVal() might logically result in zero but that dosn't mean it will return zero. If you explicilty return a zero to indicate some condition then the compare should always work but I don't think it would be best practice. I'd modify the function to return a status code and pass the value to be changed byref.