<div dir="ltr">Some of the involved numbers are bigger than can be represented in 32 bits. Therefore, the computation on 32 bit platforms will need to use more software-emulated bigintegers to perform the computation successfully, and that's where the performance difference is coming from.<div>
<br></div><div><br></div><div style>I played with this by rewriting the code in another language, Go, just out of curiosity:</div><div style><br></div><div><div> <a href="https://gist.github.com/dyoo/5708928">https://gist.github.com/dyoo/5708928</a></div>
<div class="gmail_extra"><br></div><div class="gmail_extra" style>If we switch out the representation from int64 to int32, for example, we'll see that the result is wrong. So it's very much a data representation issue.</div>
<div class="gmail_extra"><br></div></div><div class="gmail_extra"><br></div><div class="gmail_extra" style>The sum you're accumulating altogether is:</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>
15981747679237090<br></div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>which is an integer that's much bigger than natively representable with 32 bits.</div></div>