Assume we have two double real numbers a and b. a==b is the comparison operation used in Matlab to test equality. However, due to numerical issues, sometimes a and b obtained by some steps of calculation are theoretically equal but practically have a very small distance in magnitude of, say, 10^(-12). I know to compare two real numbers in practical coding, we should use something like abs(a-b)<10^(-12). I submit this thread to ask three questions:
(1) Does matlab just use a naive bit-wise comparison between floating point representations of two real numbers?
(2) If matlab internally use abs(a-b)<10^(-12) or something to implement == operation, is there any switch to control the threshold (10^(-12) in this example)?
(3) if assumption in (1) is true, since direct use of == takes a risk of producing unexpected result, why not deprecate == operator in matlab regarding real numbers to save programmer's precious time of debugging, or change it to the way described in (2)?