title: JavaScript not adding large numbers correctly (but getting very close)
body: <p>I'm trying to add up a large number but it's not coming out correctly.</p>
  
  <pre><code>var searchSpace = 36;
  var length = 11;
  var combinations = 0;
  
  for(var i = 1; i &lt;= length; i++) {
      combinations += Math.pow(searchSpace, i);
  }
  </code></pre>
  
  <p>The variable <code>combinations</code> ends up being 135,382,323,952,046,190 which is not quite correct. It should be <a href="http://www.wolframalpha.com/input/?i=36%5E1%2b36%5E2%2b36%5E3%2b36%5E4%2b36%5E5%2b36%5E6%2b36%5E7%2b36%5E8%2b36%5E9%2b36%5E10%2b36%5E11" rel="nofollow">135,382,323,952,046,196</a> (how is it off by 6?!) Any ideas?</p>