|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.MathUtil
public final class MathUtil
Math static utility methods.
Method Summary | |
---|---|
static long |
gcd(long a,
long b)
Return the greatest common divisor of a and b ,
consistently with BigInteger.gcd(BigInteger) . |
static int |
log(long x,
int base)
Returns x <= 0 ? 0 : Math.floor(Math.log(x) / Math.log(base)) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static int log(long x, int base)
x <= 0 ? 0 : Math.floor(Math.log(x) / Math.log(base))
base
- must be > 1
public static long gcd(long a, long b)
a
and b
,
consistently with BigInteger.gcd(BigInteger)
.
NOTE: A greatest common divisor must be positive, but
2^64
cannot be expressed as a long although it
is the GCD of Long.MIN_VALUE
and 0
and the GCD of
Long.MIN_VALUE
and Long.MIN_VALUE
. So in these 2 cases,
and only them, this method will return Long.MIN_VALUE
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |