public class BigDecimalMath
extends java.lang.Object
Constructor | Description |
---|---|
BigDecimalMath() |
Modifier and Type | Method | Description |
---|---|---|
static java.math.BigDecimal |
acos(java.math.BigDecimal x) |
The inverse trigonometric cosine.
|
static java.math.BigDecimal |
acosh(java.math.BigDecimal x) |
The inverse hyperbolic cosine.
|
static java.math.BigDecimal |
add(java.math.BigDecimal x,
java.math.BigInteger y) |
Add a BigDecimal and a BigInteger.
|
static BigComplex |
addRound(BigComplex x,
BigComplex y) |
Add and round according to the larger of the two ulp's.
|
static BigComplex |
addRound(BigComplex x,
java.math.BigDecimal y) |
Add and round according to the larger of the two ulp's.
|
static java.math.BigDecimal |
addRound(java.math.BigDecimal x,
java.math.BigDecimal y) |
Add and round according to the larger of the two ulp's.
|
static java.math.BigDecimal |
asin(java.math.BigDecimal x) |
The inverse trigonometric sine.
|
static java.math.BigDecimal |
asinh(java.math.BigDecimal x) |
The inverse hyperbolic sine.
|
static java.math.BigDecimal |
atan(java.math.BigDecimal x) |
The inverse trigonometric tangent.
|
protected static java.math.BigDecimal |
broadhurstBBP(int n,
int p,
int[] a,
java.math.MathContext mc) |
Broadhurst ladder sequence.
|
static java.math.BigDecimal |
cbrt(java.math.BigDecimal x) |
The cube root.
|
static java.math.BigDecimal |
cos(java.math.BigDecimal x) |
Trigonometric cosine.
|
static java.math.BigDecimal |
cosh(java.math.BigDecimal x) |
The hyperbolic cosine.
|
static double |
cot(double x) |
trigonometric cot.
|
static java.math.BigDecimal |
cot(java.math.BigDecimal x) |
The trigonometric co-tangent.
|
static java.math.BigDecimal |
divideRound(int n,
java.math.BigDecimal x) |
Divide and round.
|
static BigComplex |
divideRound(BigComplex x,
BigComplex y) |
Divide and round.
|
static java.math.BigDecimal |
divideRound(java.math.BigDecimal x,
int n) |
Divide and round.
|
static java.math.BigDecimal |
divideRound(java.math.BigDecimal x,
java.math.BigDecimal y) |
Divide and round.
|
static java.math.BigDecimal |
divideRound(java.math.BigDecimal x,
java.math.BigInteger n) |
Divide and round.
|
static BigComplex |
divideRound(java.math.BigInteger n,
BigComplex x) |
Divide and round.
|
static java.math.BigDecimal |
divideRound(java.math.BigInteger n,
java.math.BigDecimal x) |
Divide and round.
|
static int |
err2prec(double xerr) |
Convert a relative error to a precision.
|
static int |
err2prec(double x,
double xerr) |
Convert an absolute error to a precision.
|
static int |
err2prec(java.math.BigDecimal x,
java.math.BigDecimal xerr) |
Convert an absolute error to a precision.
|
static java.math.BigDecimal |
exp(java.math.BigDecimal x) |
The exponential function.
|
static java.math.BigDecimal |
exp(java.math.MathContext mc) |
The base of the natural logarithm.
|
static java.math.BigDecimal |
gamma(java.math.MathContext mc) |
Euler-Mascheroni constant.
|
static java.math.BigDecimal |
Gamma(Rational q,
java.math.MathContext mc) |
The Gamma function.
|
static java.math.BigDecimal |
Gamma(java.math.BigDecimal x) |
The Gamma function.
|
static java.math.BigDecimal |
hypot(int n,
java.math.BigDecimal x) |
The hypotenuse.
|
static java.math.BigDecimal |
hypot(java.math.BigDecimal x,
java.math.BigDecimal y) |
The hypotenuse.
|
static BigComplex |
invertRound(BigComplex z) |
Build the inverse and maintain the approximate accuracy.
|
static java.math.BigDecimal |
log(int n,
java.math.MathContext mc) |
The natural logarithm.
|
static java.math.BigDecimal |
log(Rational r,
java.math.MathContext mc) |
The natural logarithm.
|
static java.math.BigDecimal |
log(java.math.BigDecimal x) |
The natural logarithm.
|
static java.math.BigDecimal |
mod2pi(java.math.BigDecimal x) |
Reduce value to the interval [0,2*Pi].
|
static java.math.BigDecimal |
modpi(java.math.BigDecimal x) |
Reduce value to the interval [-Pi/2,Pi/2].
|
static BigComplex |
multiplyRound(BigComplex x,
BigComplex y) |
Multiply and round.
|
static BigComplex |
multiplyRound(BigComplex x,
java.math.BigDecimal y) |
Multiply and round.
|
static java.math.BigDecimal |
multiplyRound(java.math.BigDecimal x,
int n) |
Multiply and round.
|
static java.math.BigDecimal |
multiplyRound(java.math.BigDecimal x,
Rational f) |
Multiply and round.
|
static java.math.BigDecimal |
multiplyRound(java.math.BigDecimal x,
java.math.BigDecimal y) |
Multiply and round.
|
static java.math.BigDecimal |
multiplyRound(java.math.BigDecimal x,
java.math.BigInteger n) |
Multiply and round.
|
static java.math.BigDecimal |
pi(java.math.MathContext mc) |
Euler's constant.
|
static java.math.BigDecimal |
pochhammer(java.math.BigDecimal x,
int n) |
Pochhammer's function.
|
static java.math.BigDecimal |
pow(java.math.BigDecimal x,
java.math.BigDecimal y) |
Power function.
|
static java.math.BigDecimal |
powRound(java.math.BigDecimal x,
int n) |
Raise to an integer power and round.
|
static java.math.BigDecimal |
powRound(java.math.BigDecimal x,
Rational q) |
Raise to a fractional power and round.
|
static java.math.BigDecimal |
powRound(java.math.BigDecimal x,
java.math.BigInteger n) |
Raise to an integer power and round.
|
static double |
prec2err(double x,
int prec) |
Convert a precision (relative error) to an absolute error.
|
static double |
psi(double x) |
Digamma function.
|
static java.math.BigDecimal |
root(int n,
java.math.BigDecimal x) |
The integer root.
|
static BigComplex |
scalePrec(BigComplex x,
int d) |
Append decimal zeros to the value.
|
static java.math.BigDecimal |
scalePrec(java.math.BigDecimal x,
int d) |
Append decimal zeros to the value.
|
static java.math.BigDecimal |
scalePrec(java.math.BigDecimal x,
java.math.MathContext mc) |
Boost the precision by appending decimal zeros to the value.
|
static java.math.BigDecimal |
sin(java.math.BigDecimal x) |
Trigonometric sine.
|
static java.math.BigDecimal |
sinh(java.math.BigDecimal x) |
The hyperbolic sine.
|
static java.math.BigDecimal |
sqrt(java.math.BigDecimal x) |
The square root.
|
static java.math.BigDecimal |
sqrt(java.math.BigDecimal x,
java.math.MathContext mc) |
The square root.
|
static BigComplex |
subtractRound(BigComplex x,
BigComplex y) |
Subtract and round according to the larger of the two ulp's.
|
static java.math.BigDecimal |
subtractRound(java.math.BigDecimal x,
java.math.BigDecimal y) |
Subtract and round according to the larger of the two ulp's.
|
static java.math.BigDecimal |
tan(java.math.BigDecimal x) |
The trigonometric tangent.
|
static java.math.BigDecimal |
tanh(java.math.BigDecimal x) |
The hyperbolic tangent.
|
static java.math.BigDecimal |
zeta(int n,
java.math.MathContext mc) |
Riemann zeta function.
|
static double |
zeta1(int n) |
Riemann zeta function.
|
public static java.math.BigDecimal pi(java.math.MathContext mc)
mc
- The required precision of the result.public static java.math.BigDecimal gamma(java.math.MathContext mc)
mc
- The required precision of the result.public static java.math.BigDecimal sqrt(java.math.BigDecimal x, java.math.MathContext mc)
x
- the non-negative argument.mc
- public static java.math.BigDecimal sqrt(java.math.BigDecimal x)
x
- the non-negative argument.public static java.math.BigDecimal cbrt(java.math.BigDecimal x)
x
- The argument.public static java.math.BigDecimal root(int n, java.math.BigDecimal x)
n
- the positive argument.x
- the non-negative argument.public static java.math.BigDecimal hypot(java.math.BigDecimal x, java.math.BigDecimal y)
x
- the first argument.y
- the second argument.public static java.math.BigDecimal hypot(int n, java.math.BigDecimal x)
n
- the first argument.x
- the second argument.public static java.math.BigDecimal exp(java.math.BigDecimal x)
x
- the argument.public static java.math.BigDecimal exp(java.math.MathContext mc)
mc
- the required precision of the resultpublic static java.math.BigDecimal log(java.math.BigDecimal x)
x
- the argument.public static java.math.BigDecimal log(int n, java.math.MathContext mc)
n
- The main argument, a strictly positive integer.mc
- The requirements on the precision.public static java.math.BigDecimal log(Rational r, java.math.MathContext mc)
r
- The main argument, a strictly positive value.mc
- The requirements on the precision.public static java.math.BigDecimal pow(java.math.BigDecimal x, java.math.BigDecimal y)
x
- Base of the power.y
- Exponent of the power.public static java.math.BigDecimal powRound(java.math.BigDecimal x, int n)
x
- The base.n
- The exponent.public static java.math.BigDecimal powRound(java.math.BigDecimal x, java.math.BigInteger n)
x
- The base.n
- The exponent. The current implementation allows n only in the
interval of the standard int values.public static java.math.BigDecimal powRound(java.math.BigDecimal x, Rational q)
x
- The base. Generally enforced to be positive, with the
exception of integer exponents where the sign is carried over
according to the parity of the exponent.q
- The exponent.public static java.math.BigDecimal sin(java.math.BigDecimal x)
x
- The argument in radians.public static java.math.BigDecimal cos(java.math.BigDecimal x)
x
- The argument in radians.public static java.math.BigDecimal tan(java.math.BigDecimal x)
x
- the argument in radians.public static java.math.BigDecimal cot(java.math.BigDecimal x)
x
- the argument in radians.public static java.math.BigDecimal asin(java.math.BigDecimal x)
x
- the argument.public static java.math.BigDecimal acos(java.math.BigDecimal x)
x
- the argument.public static java.math.BigDecimal atan(java.math.BigDecimal x)
x
- the argument.public static java.math.BigDecimal cosh(java.math.BigDecimal x)
x
- The argument.public static java.math.BigDecimal sinh(java.math.BigDecimal x)
x
- the argument.public static java.math.BigDecimal tanh(java.math.BigDecimal x)
x
- The argument.public static java.math.BigDecimal asinh(java.math.BigDecimal x)
x
- The argument.public static java.math.BigDecimal acosh(java.math.BigDecimal x)
x
- The argument.public static java.math.BigDecimal Gamma(java.math.BigDecimal x)
x
- The argument.public static java.math.BigDecimal Gamma(Rational q, java.math.MathContext mc)
q
- The argument.mc
- The required accuracy in the result.public static java.math.BigDecimal pochhammer(java.math.BigDecimal x, int n)
x
- The main argument.n
- The non-negative index.public static java.math.BigDecimal mod2pi(java.math.BigDecimal x)
x
- the original valuepublic static java.math.BigDecimal modpi(java.math.BigDecimal x)
x
- The original valuepublic static java.math.BigDecimal zeta(int n, java.math.MathContext mc)
n
- The positive integer argument.mc
- Specification of the accuracy of the result.public static double zeta1(int n)
n
- The positive integer argument.public static double cot(double x)
x
- The argument.public static double psi(double x)
x
- The main argument.protected static java.math.BigDecimal broadhurstBBP(int n, int p, int[] a, java.math.MathContext mc)
a
- The vector of 8 integer argumentsmc
- Specification of the accuracy of the resultpublic static java.math.BigDecimal add(java.math.BigDecimal x, java.math.BigInteger y)
x
- The left summandy
- The right summandpublic static java.math.BigDecimal addRound(java.math.BigDecimal x, java.math.BigDecimal y)
x
- The left summandy
- The right summandpublic static BigComplex addRound(BigComplex x, java.math.BigDecimal y)
x
- The left summandy
- The right summandpublic static BigComplex addRound(BigComplex x, BigComplex y)
x
- The left summandy
- The right summandpublic static java.math.BigDecimal subtractRound(java.math.BigDecimal x, java.math.BigDecimal y)
x
- The left term.y
- The right term.public static BigComplex subtractRound(BigComplex x, BigComplex y)
x
- The left summandy
- The right summandpublic static java.math.BigDecimal multiplyRound(java.math.BigDecimal x, java.math.BigDecimal y)
x
- The left factor.y
- The right factor.public static BigComplex multiplyRound(BigComplex x, java.math.BigDecimal y)
x
- The left factor.y
- The right factor.public static BigComplex multiplyRound(BigComplex x, BigComplex y)
x
- The left factor.y
- The right factor.public static java.math.BigDecimal multiplyRound(java.math.BigDecimal x, Rational f)
x
- The left factor.f
- The right factor.public static java.math.BigDecimal multiplyRound(java.math.BigDecimal x, int n)
x
- The left factor.n
- The right factor.public static java.math.BigDecimal multiplyRound(java.math.BigDecimal x, java.math.BigInteger n)
x
- The left factor.n
- The right factor.public static java.math.BigDecimal divideRound(java.math.BigDecimal x, java.math.BigDecimal y)
x
- The numeratory
- The denominatorpublic static BigComplex invertRound(BigComplex z)
z
- The denominatorpublic static BigComplex divideRound(BigComplex x, BigComplex y)
x
- The numeratory
- The denominatorpublic static java.math.BigDecimal divideRound(java.math.BigDecimal x, int n)
x
- The numeratorn
- The denominatorpublic static java.math.BigDecimal divideRound(java.math.BigDecimal x, java.math.BigInteger n)
x
- The numeratorn
- The denominatorpublic static java.math.BigDecimal divideRound(java.math.BigInteger n, java.math.BigDecimal x)
n
- The numeratorx
- The denominatorpublic static BigComplex divideRound(java.math.BigInteger n, BigComplex x)
n
- The numeratorx
- The denominatorpublic static java.math.BigDecimal divideRound(int n, java.math.BigDecimal x)
n
- The numerator.x
- The denominator.public static java.math.BigDecimal scalePrec(java.math.BigDecimal x, int d)
x
- The input valued
- The (positive) value of zeros to be added as least significant
digits.public static BigComplex scalePrec(BigComplex x, int d)
x
- The input valued
- The (positive) value of zeros to be added as least significant
digits.public static java.math.BigDecimal scalePrec(java.math.BigDecimal x, java.math.MathContext mc)
x
- The input valuemc
- The requirement on the minimum precision on return.public static int err2prec(java.math.BigDecimal x, java.math.BigDecimal xerr)
x
- The value of the variablexerr
- The absolute error in the variablepublic static int err2prec(double x, double xerr)
x
- The value of the variable The value returned depends only on
the absolute value, not on the sign.xerr
- The absolute error in the variable The value returned depends
only on the absolute value, not on the sign.public static int err2prec(double xerr)
xerr
- The relative error in the variable. The value returned depends
only on the absolute value, not on the sign.public static double prec2err(double x, int prec)
x
- The value of the variable The value returned depends only on
the absolute value, not on the sign.prec
- The number of valid digits of the variable.