In Javascript (in Chrome devtools console panel and Node.js v0.12.5), I'm getting an incorrect answer for the product of these two large numbers:
input: 41962049 * 1827116622
output: 76669557221078480
In C++ and C#, I get the correct answer of 76669557221078478
when casting the expression to a 64-bit int.
I'm assuming this is an integer overflow issue, but I certainly could be wrong.
Is there a way to get accurate arithmetic products for large numbers in Javascript without using an external library like BigInteger? This is for an online class that doesn't allow additional libraries.
Thanks for your help.
EDIT: Thanks for the explanation explaining how this isn't actually integer overflow, Patrick Roberts! Very useful.
EDIT 2: jfriend00, I think this question is different than the one you linked to because I am trying to figure out if there is a way to work around JS's limitations without relying on an external library. The answer you provided in the comments helped answer my question, so thank you!