-
-
Notifications
You must be signed in to change notification settings - Fork 18
factorial_stirling
Vašek edited this page Feb 6, 2019
·
1 revision
This function returns Stirling's approximation of the factorial of the given number
factorial_stirling(n)
Argument | Description |
---|---|
int n |
The given number |
Returns: int
Stirling's approximation (or Stirling's formula) is an approximation for factorials. It is a good approximation, leading to accurate results even for small values of n. This function is much way faster then factorial.
int value = factorial_stirling(5);
This Function will set value
to 118. Correct result of 5! is 120, so the acuraccy for number 5 is 98,3%.
int value = factorial_stirling(10);
This Function will set value
to 3598695. Correct result of 10! is 3628800, so the acuraccy for number 10 is 99,17%.
Back to number_functions