i have been trying to get some mod arithmetic done in C++ but i am having some problems. It gives me a different asnwer ( the wrong one)...i believe its the size of the var. but i could be wrong.
result = powl(m,e);
c = fmodl(result,n);
results = powl(c,d);
mm = fmodl(results,n);
for c, getting the result of 3^13 mod 77 is not a problem (its 38). But for mm, which is BTW 38^37 mod 77, i get 0 or 8 instead of 3 (3 is the right answer).
FYI: results, result and mm are long double; while c,d,e and n are integers.