title: diff function in matlab
body: <p>I know <code>diff</code> calculates the discreete derivative, or let's say the difference between consequitive components of a vector.</p>
  
  <p>Not I define a variable</p>
  
  <pre><code>x=-4:1/10:4;
  y=diff(diff(x));
  </code></pre>
  
  <p>Why the heck do I get <code>1.e-15*</code> and a row of vectors that are non zero? Matlab is being honest by displaying that somehow, in calculating <code>x=-4:1/10:4;</code> it had rounded some digits and though while I execute <code>y=(diff(x));</code> only and even though it displays all digits same, it some how shows that in it's core they are not stored as same quantities(because it rounded off -4+0.1 or some quantity as other than -3.9 ???). Now, how do I get the standard output? How do I get 0 when it is really zero, like in this case, and non zero whatever it may be like even like <code>1*e-...</code>, when it is actually non zero?</p>
  
  <p><em>Note</em> if that is not possible, how do I calculate real/actual <code>diff(x,2)</code>, or atleast accurate sign and zero when diff is actually zero? and get the real discreete derivative for functions like <code>cosine</code> instead of some misleading value? </p>
  
  <p>I need to calculate inflection point using diff.</p>