added logarithm to arbitrary base

This commit is contained in:
Alexander Seitz 2012-12-17 09:14:45 +00:00
parent c2e37929da
commit e3dab9cfeb

View File

@ -149,6 +149,18 @@ public final class SpecialFunction extends Object {
return Math.log(x)/2.30258509299404568401; return Math.log(x)/2.30258509299404568401;
} }
/**
*
* @param b Base of the logarithm
* @param x a double value
* @return The log<sub>b</sub>
* @throws ArithmeticException
*/
static public double logb(double b, double x) throws ArithmeticException {
if( x <= 0.0 ) throw new ArithmeticException("range exception");
return Math.log(x)/Math.log(b);
}
/** /**
* @param x a double value * @param x a double value