Package org.apache.lucene.util
Class MathUtil
- java.lang.Object
 - 
- org.apache.lucene.util.MathUtil
 
 
- 
public final class MathUtil extends java.lang.ObjectMath static utility methods. 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleacosh(double a)Calculates inverse hyperbolic cosine of adoublevalue.static doubleasinh(double a)Calculates inverse hyperbolic sine of adoublevalue.static doubleatanh(double a)Calculates inverse hyperbolic tangent of adoublevalue.static longgcd(long a, long b)Return the greatest common divisor ofaandb, consistently withBigInteger.gcd(BigInteger).static doublelog(double base, double x)Calculates logarithm in a given base with doubles.static intlog(long x, int base)Returnsx <= 0 ? 0 : Math.floor(Math.log(x) / Math.log(base)) 
 - 
 
- 
- 
Method Detail
- 
log
public static int log(long x, int base)Returnsx <= 0 ? 0 : Math.floor(Math.log(x) / Math.log(base))- Parameters:
 base- must be> 1
 
- 
log
public static double log(double base, double x)Calculates logarithm in a given base with doubles. 
- 
gcd
public static long gcd(long a, long b)Return the greatest common divisor ofaandb, consistently withBigInteger.gcd(BigInteger).NOTE: A greatest common divisor must be positive, but
2^64cannot be expressed as a long although it is the GCD ofLong.MIN_VALUEand0and the GCD ofLong.MIN_VALUEandLong.MIN_VALUE. So in these 2 cases, and only them, this method will returnLong.MIN_VALUE. 
- 
asinh
public static double asinh(double a)
Calculates inverse hyperbolic sine of adoublevalue.Special cases:
- If the argument is NaN, then the result is NaN.
 - If the argument is zero, then the result is a zero with the same sign as the argument.
 - If the argument is infinite, then the result is infinity with the same sign as the argument.
 
 
- 
acosh
public static double acosh(double a)
Calculates inverse hyperbolic cosine of adoublevalue.Special cases:
- If the argument is NaN, then the result is NaN.
 - If the argument is +1, then the result is a zero.
 - If the argument is positive infinity, then the result is positive infinity.
 - If the argument is less than 1, then the result is NaN.
 
 
- 
atanh
public static double atanh(double a)
Calculates inverse hyperbolic tangent of adoublevalue.Special cases:
- If the argument is NaN, then the result is NaN.
 - If the argument is zero, then the result is a zero with the same sign as the argument.
 - If the argument is +1, then the result is positive infinity.
 - If the argument is -1, then the result is negative infinity.
 - If the argument's absolute value is greater than 1, then the result is NaN.
 
 
 - 
 
 -