C# '%' doesn't work correctly for huge numbers | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

C# '%' doesn't work correctly for huge numbers

If we do: Math.Pow(3701, 37) % 10379 we will recieve the wrong answer. The correct one is 7770. Can anyone explain the situation to me?

12th Sep 2019, 8:58 AM
Paul Smith
Paul Smith - avatar
3 Réponses
0
Was the wrong answer 6273?
12th Sep 2019, 9:23 AM
Seb TheS
Seb TheS - avatar
0
I thought it would be caused by the maximum integer size limit.
12th Sep 2019, 9:27 AM
Seb TheS
Seb TheS - avatar
0
We use double for pow
12th Sep 2019, 1:29 PM
Paul Smith
Paul Smith - avatar