I know it's bad to make direct comparisons between floating point numbers in C, and that instead you should do something like:
if (float_1 - float_2 < ...)
to test for equality, that is, if float_1 - float_2 is smaller than some number, then you assume the numbers are equal. My question is what number do I compare against? How small a number do I have to use to ensure the 2 numbers are equal?
if (float_1 - float_2 < ...)
to test for equality, that is, if float_1 - float_2 is smaller than some number, then you assume the numbers are equal. My question is what number do I compare against? How small a number do I have to use to ensure the 2 numbers are equal?
