public final class Arithmetic extends Object
Modifier and Type | Method and Description |
---|---|
static double |
binomial(long n,
long k)
Efficiently returns the binomial coefficient, often also referred to as "n over k" or "n choose k".
|
static double |
logFactorial(int k)
Returns log(k!).
|
public static double binomial(long n, long k)
public static double logFactorial(int k)
k<30
simply
looks up a table in O(1). For k>=30
uses stirlings
approximation.k
- must hold k >= 0.Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.