I want to subtract 1 from 1+0.5*10^-15. When I enter 1+0.5*10^-15 in MATLAB command prompt, I get 1.000000000000000e+000 and not 1.0000000000000005e+000. I understand it is because of the displaying limitation of format long e. But when I subtract 1 from this number (1.000000000000000e+000), I get 4.440892098500626e-016 which is very close to 5.000000000000000e-016 but not exactly equal to it. Now this is not a displaying limitation of format long e. Why is this happening?
MATLAB: Computer Arithematic
floating pointMATLABprecision
Best Answer