title: Sum function error
body: <p>I was trying to my statistics homework using R when I ran into a problem with the <em>sum</em>() function. Given this vector:</p>
  
  <pre><code>-18.4,  -5.4,   1.6,   5.6,  16.6
  </code></pre>
  
  <p>When I tried to use <em>sum</em> on the vector I got the following result:</p>
  
  <pre><code>2.220446e-15
  </code></pre>
  
  <p>If I do it a different way (the way I got that data) then I get another answer:</p>
  
  <pre><code>class2
  
  [1]  65  78  85  89 100
  
  class2mean
  
  [1] 83.4
  
  l&lt;-class2-class2mean
  
  sum(l)
  
  [1] -2.842171e-14
  
  l
  
  [1] -18.4  -5.4   1.6   5.6  16.6
  </code></pre>
  
  <p>Obviously that answer is not correct. However when I tried to do the same calculation by 'hand' I got another result:</p>
  
  <pre><code>-18.4+-5.4+1.6+5.6+16.6
  
  [1] 7.105427e-15
  </code></pre>
  
  <p>Finally I had to give up and just use my calculator. If anybody can provide me with some help or answers. Obviously I must be doing something wrong, but I do not know what and as this is such a fundamental function, I need to know how to use it correctly and effectively. Thank you!</p>