Class Factorial
java.lang.Object
org.apache.commons.numbers.combinatorics.Factorial
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubledoubleValue(int n) Computes the factorial ofn.static longvalue(int n) Computes the factorial ofn.
-
Method Details
-
value
Computes the factorial ofn.- Parameters:
n- Argument.- Returns:
n!- Throws:
IllegalArgumentException- ifn < 0.IllegalArgumentException- ifn > 20(the factorial value is too large to fit in along).
-
doubleValue
Computes the factorial ofn.The result should be small enough to fit into a
double: The largestnfor whichn!does not exceedDouble.MAX_VALUEis 170.Double.POSITIVE_INFINITYis returned forn > 170.- Parameters:
n- Argument.- Returns:
n!- Throws:
IllegalArgumentException- ifn < 0.- Since:
- 1.1
-