MATLAB: Binomial theorem and MATLAB

(x-1)^7binomial theoremMATLAB

Hello,
I habe 3 variables:
x= 0.988:0.0001:1.012;
y= (x-1).^7
y2=x.^7-7*x.^6+21*x.^5-35*x.^4+35*x.^3-21*x.^2+7*x-1;
y2 is the therm (x-1)^2 calculated with the binomial theorem.
So, to my understanding the solution for every x should be the same in y and y2:
But this is my Result:
Would be awesome if someone could explain this odd result to me 🙂

Best Answer

Cleve Moler, the original author of MATLAB, wrote am article about this (with this specific example) in 1996.
https://www.mathworks.com/company/newsletters/articles/floating-points-ieee-standard-unifies-arithmetic-model.html