+ 1
Why large calulation in c++ are always wrong?
2 odpowiedzi
+ 8
Because of overflow.
Every number type, like int, what you're probably using, has maximum upper and lower limits, and if you go beyond them, your results get messed up.
Look for example here:
https://docs.microsoft.com/en-us/cpp/cpp/integer-limits?view=vs-2017
+ 6
try to use long int to avoid this problem