Unexpected results when working with very big integers on interpreted languages

I am trying to get the sum of 1 + 2 + … + 1000000000, but I’m getting funny results in PHP and Node.js. PHP $sum = 0; for($i = 0; $i <= 1000000000 ; $i++) { $sum += $i; } printf(“%s”, number_format($sum, 0, “”, “”)); // 500000000067108992 Node.js var sum = 0; for (i … Read more