I am adding 21 elements of an array by two different methods. The two methods should show same value. But while printing the results the are different. Please suggest.
x = single(x)
method1 = sum(x(1:21))+x(22)-x(1);
method2 = sum(x(2:22));