On 05/22/2012 03:27 PM, marco atzeri wrote:
On 5/22/2012 8:26 PM, Sergei Steshenko wrote:
Though not related to your original question, 0.1 may be a periodic
fraction in your _binary_ CPU, so you better write
t = 0.1 * [-10:1:10];
irrilevant in this case
octave:4> [-1:0.1:1;]-0.1*[-10:1:10;]<eps
<... shows that the differences are all less than eps ...>
Well, the point of 'eps' is that it is the smallest normalized number so
it masks the simple roundoff errors. In this case you haven't
accumulated enough of roundoff to exceed eps, but if you keep going you
eventually will. A quick try shows that you need four orders of
magnitude more operations:
min([-1:0.00001:1;]-0.00001*[-100000:1:100000;]<eps)
Sergei showed you the correct form that will never fail.