title: -Infinity values in Java
body: <p>I'm trying to sum 561 logs.<br>
  They look like these:  </p>
  
  <pre><code>-7.314254939475686
  -7.656004233197743
  -4.816276208120333
  -8.426112454893817
  -4.771824445549499
  -9.34240318676797  
  </code></pre>
  
  <p>So they're not big numbers. However, when I proceed with summing them I get this:  </p>
  
  <pre><code>-2668.179647264475
  -2674.7747795369874
  -2679.18920466334
  -2683.9724816026214
  -2690.3342661536453
  -Infinity
  -Infinity  
  </code></pre>
  
  <p>The code that does it is:  </p>
  
  <pre><code>double probspam=0;
  
  for(int j=0;j&lt;words.size();j++)
  {
      probspam+= Math.log(spam.getClassProbability(words.get(j)));
  
  }  
  </code></pre>
  
  <p>Do you have any idea of how to get around the -Infinity issue and why it happens? Thank you</p>