|
|
It took 141 milliseconds to compute 39916800 handled recursively. It took 156 milliseconds to compute 39916800 without recursion handling. It took 32 milliseconds to compute 479001600 handled recursively. It took 171 milliseconds to compute 479001600 without recursion handling. |
That saves the result of the thus far largest called parameter to rh_factorial and relied upon it, rather than recursing down to the base relation. |
I was wondering is there any reason why, despite having declared everying very long int why it can't compute accurate results beyond 12!? |
int
multiplication here:int rv = num*(rh_factorial(num-1));
Like maybe have a int * of various results predefined at certain intervals? |
long long
.And lastly, does anyone know if there are any hardware implementations of this kind of 'recursion handling' in CPUS? |
typedef long very;
with very long
. I also didn't have the implementation of clearbuf()
. I removed the calls to Sleep
because they didn't seem necessary. Note the formats in the calls to printf
|
|
Good day. Enter a number to get the factorial of. >13 The handled factorial of 13 is 6227020800. The straight factorial of 13 is 6227020800. It took 0 milliseconds to compute 6227020800 handled recursively. It took 0 milliseconds to compute 6227020800 without recursion handling. Another? 0 for no 1 for yes. >1 Enter a number to get the factorial of. >14 The handled factorial of 14 is 87178291200. The straight factorial of 14 is 87178291200. It took 0 milliseconds to compute 87178291200 handled recursively. It took 0 milliseconds to compute 87178291200 without recursion handling. Another? 0 for no 1 for yes. >1 Enter a number to get the factorial of. >15 The handled factorial of 15 is 1307674368000. The straight factorial of 15 is 1307674368000. It took 0 milliseconds to compute 1307674368000 handled recursively. It took 0 milliseconds to compute 1307674368000 without recursion handling. Another? 0 for no 1 for yes. >0 Thank you. Press any key to continue . . . |