added logarithm to arbitrary base
This commit is contained in:
parent
c2e37929da
commit
e3dab9cfeb
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user