public class Factorial
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| protected static double[] | doubleFactorials | 
| protected static long[] | longFactorials | 
| Constructor and Description | 
|---|
| Factorial() | 
| Modifier and Type | Method and Description | 
|---|---|
| static double | factorial(int n)Compute factorial of an integer. | 
| static double | logFactorial(int n)Computes the natural log of n factorial. | 
protected static final long[] longFactorials
protected static final double[] doubleFactorials
public static double factorial(int n)
n - Number for which to compute factorial.public static double logFactorial(int n)
n - The number for which the log factorial is desired.We use the LogGamma function to compute log(n!) using the relation:
log(n!) = logGamma( n + 1 )