Can anyone explain this algorithm for calculating large factorials?
问题 i came across the following program for calculating large factorials(numbers as big as 100).. can anyone explain me the basic idea used in this algorithm?? I need to know just the mathematics implemented in calculating the factorial. #include <cmath> #include <iostream> #include <cstdlib> using namespace std; int main() { unsigned int d; unsigned char *a; unsigned int j, n, q, z, t; int i,arr[101],f; double p; cin>>n; p = 0.0; for(j = 2; j <= n; j++) p += log10(j); d = (int)p + 1; a = new