I'm porting a Windows C# application to C++ on 64-bit Ubuntu v14.04. The problem I'm having is that the c# version uses a very large decimal #, 7317798979557510901670260274, and performs a modulus on it.
The c# code:
1 2
decimal num = 7317798979557510901670260274;
int value = (num % 26);
In C#, value = 6.
The c++ code:
1 2
longdouble num = 7317798979557510901670260274.0;
int value = (int)std::fmod(num, 26);
In C++, value = 12.
Can anyone tell me what I'm doing wrong and point me to a solution?