Modifier and Type | Method and Description |
---|---|
static double |
doubleValue(int n)
Computes the factorial of
n . |
static long |
value(int n)
Computes the factorial of
n . |
public static long value(int n)
n
.n
- Argument.n!
IllegalArgumentException
- if n < 0
.IllegalArgumentException
- if n > 20
(the factorial
value is too large to fit in a long
).public static double doubleValue(int n)
n
.
The result should be small enough to fit into a double
: The
largest n
for which n!
does not exceed
Double.MAX_VALUE
is 170. Double.POSITIVE_INFINITY
is
returned for n > 170
.
n
- Argument.n!
IllegalArgumentException
- if n < 0
.Copyright © 2017–2022 The Apache Software Foundation. All rights reserved.