I've run across in issue where two values that are supposed to be equivalent are subtracted and their result doesn't yield 0, but rather an extremely small number. I'm not sure if this is a known issue with data typing and precision. Interestingly enough when viewing the numbers in format LONGENG, they also appear to be the same number. This isn't too much of a problem most of the time, but when relational operators are used (<, >, <=, …) this extremely small number and 0 relate as expected i.e. small # == 0 returns 0.
Edit:
So every time I want to manipulate numbers in MATLAB I have to fix or round them to some precision? Which would also mean changing the units of any values in scientific notation i.e. fix(10.123E-9) = 0
Also
"‘small # == 0 returns 0’ is inaccurate."
"relate as expected i.e. small # == 0 returns 0."
Relational operators don't have a tolerance (at least to my knowledge) so I would say that 'small# == 0' should return 0 because I'm using == rather than ~= and small# is NOT equal to 0. I;ve attached a screen shot.
This becomes problematic when using relational operators after some algebra has been done on the numbers in question and equations that should yield 0 now yield small#
Best Answer