public class FixedPrecisionApfloatHelper extends FixedPrecisionApcomplexHelper
All results of the mathematical operations are set to have the specified precision.
Also all input arguments are set to the specified precision before the operation.
If the specified precision is not infinite, this helper class also avoids
InfiniteExpansionException
e.g. in case where it would happen with
ApfloatMath.acos(Apfloat.ZERO)
.
Constructor and Description |
---|
FixedPrecisionApfloatHelper(long precision)
Constructs an apfloat fixed-precison helper with the specified precision.
|
Modifier and Type | Method and Description |
---|---|
Apfloat |
abs(Apfloat x)
Absolute value.
|
Apfloat |
acos(Apfloat x)
Arc cosine.
|
Apfloat |
acosh(Apfloat x)
Hyperbolic arc cosine.
|
Apfloat |
add(Apfloat x,
Apfloat y)
Addition.
|
Apfloat |
agm(Apfloat a,
Apfloat b)
Arithmetic-geometric mean.
|
Apfloat |
asin(Apfloat x)
Arc sine.
|
Apfloat |
asinh(Apfloat x)
Hyperbolic arc sine.
|
Apfloat |
atan(Apfloat x)
Arc tangent.
|
Apfloat |
atan2(Apfloat x,
Apfloat y)
Angle of point.
|
Apfloat |
atanh(Apfloat x)
Hyperbolic arc tangent.
|
Apfloat |
cbrt(Apfloat x)
Cube root.
|
Apfloat |
ceil(Apfloat x)
Ceiling function.
|
Apfloat |
copySign(Apfloat x,
Apfloat y)
Copies the sign from one number to another.
|
Apfloat |
cos(Apfloat x)
Cosine.
|
Apfloat |
cosh(Apfloat x)
Hyperbolic cosine.
|
Apfloat |
divide(Apfloat x,
Apfloat y)
Division.
|
Apfloat |
exp(Apfloat x)
Exponential function.
|
Apfloat |
factorial(long n)
Factorial.
|
Apfloat |
factorial(long n,
int radix)
Factorial.
|
Apfloat |
floor(Apfloat x)
Floor function.
|
Apfloat |
fmod(Apfloat x,
Apfloat y)
Modulus.
|
Apfloat |
frac(Apfloat x)
Extract fractional part.
|
Apfloat |
inverseRoot(Apfloat x,
long n)
Inverse root.
|
Apfloat |
log(Apfloat x)
Natural logarithm.
|
Apfloat |
log(Apfloat x,
Apfloat b)
Logarithm in specified base.
|
Apfloat |
logRadix(int radix)
Logarithm.
|
Apfloat |
mod(Apfloat x,
Apfloat y)
Modulus.
|
Apfloat[] |
modf(Apfloat x)
Split to integer and fractional parts.
|
Apfloat |
multiply(Apfloat x,
Apfloat y)
Multiplication.
|
Apfloat |
multiplyAdd(Apfloat a,
Apfloat b,
Apfloat c,
Apfloat d)
Fused multiply-add.
|
Apfloat |
multiplySubtract(Apfloat a,
Apfloat b,
Apfloat c,
Apfloat d)
Fused multiply-subtract.
|
Apfloat |
negate(Apfloat x)
Negation.
|
Apfloat |
pi()
π.
|
Apfloat |
pi(int radix)
π.
|
Apfloat |
pow(Apfloat x,
Apfloat y)
Power.
|
Apfloat |
pow(Apfloat x,
long n)
Integer power.
|
Apfloat |
product(Apfloat... x)
Product.
|
Apfloat |
root(Apfloat x,
long n)
Root.
|
Apfloat |
round(Apfloat x,
RoundingMode roundingMode)
Round with specified rounding mode.
|
Apfloat |
scale(Apfloat x,
long scale)
Move the radix point.
|
Apfloat |
sin(Apfloat x)
Sine.
|
Apfloat |
sinh(Apfloat x)
Hyperbolic sine.
|
Apfloat |
sqrt(Apfloat x)
Square root.
|
Apfloat |
subtract(Apfloat x,
Apfloat y)
Subtraction.
|
Apfloat |
sum(Apfloat... x)
Sum.
|
Apfloat |
tan(Apfloat x)
Tangent.
|
Apfloat |
tanh(Apfloat x)
Hyperbolic tangent.
|
Apfloat |
toDegrees(Apfloat x)
Convert radians to degrees.
|
Apfloat |
toRadians(Apfloat x)
Convert degrees to radians.
|
Apfloat |
truncate(Apfloat x)
Truncate fractional part.
|
Apfloat |
valueOf(Apfloat x)
Returns the value with the specified precision.
|
Apfloat |
w(Apfloat x)
Lambert W function.
|
abs, acos, acosh, add, agm, allRoots, arg, asin, asinh, atan, atanh, cbrt, conj, cos, cosh, divide, exp, imag, inverseRoot, inverseRoot, log, log, multiply, negate, norm, pow, pow, precision, product, real, root, root, scale, sin, sinh, sqrt, subtract, sum, tan, tanh, valueOf, w, w
public FixedPrecisionApfloatHelper(long precision) throws IllegalArgumentException
precision
- The precision of the results.IllegalArgumentException
- In case the precision is invalid.public Apfloat valueOf(Apfloat x)
x
- The value.public Apfloat negate(Apfloat x) throws ApfloatRuntimeException
x
- The value to negate.-x
.ApfloatRuntimeException
public Apfloat add(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x
- The first operand.y
- The second operand.x + y
.ApfloatRuntimeException
public Apfloat subtract(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x
- The first operand.y
- The second operand.x - y
.ApfloatRuntimeException
public Apfloat multiply(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x
- The first operand.y
- The second operand.x * y
.ApfloatRuntimeException
public Apfloat divide(Apfloat x, Apfloat y) throws ArithmeticException, ApfloatRuntimeException
x
- The first operand.y
- The second operand.x / y
.ArithmeticException
- If y
is zero.ApfloatRuntimeException
public Apfloat pow(Apfloat x, Apfloat y) throws ArithmeticException, ApfloatRuntimeException
x
- The first operand.y
- The second operand.xy
.ArithmeticException
- If x
and y
are zero, or x
is negative.ApfloatRuntimeException
public Apfloat pow(Apfloat x, long n) throws ArithmeticException, ApfloatRuntimeException
x
- The first operand.n
- The second operand.xn
.ArithmeticException
- If x
and n
are zero, or x
is zero and n
is negative.ApfloatRuntimeException
public Apfloat abs(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat acos(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.x
.ArithmeticException
- If the absolute value of x
is more than one.ApfloatRuntimeException
public Apfloat acosh(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.x
.ArithmeticException
- If the x
is less than one.ApfloatRuntimeException
public Apfloat asin(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.x
.ArithmeticException
- If the absolute value of x
is more than one.ApfloatRuntimeException
public Apfloat asinh(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat atan(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat atanh(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.x
.ArithmeticException
- If the absolute value of x
is equal to or more than one.ApfloatRuntimeException
public Apfloat cbrt(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat cos(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat cosh(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat exp(Apfloat x) throws ApfloatRuntimeException
x
- The operand.ex
.ApfloatRuntimeException
public Apfloat log(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.x
.ArithmeticException
- If x
is less than or equal to zero.ApfloatRuntimeException
public Apfloat log(Apfloat x, Apfloat b) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.b
- The base.b
logarithm of x
.ArithmeticException
- If x
or b
is less than or equal to zero.ApfloatRuntimeException
public Apfloat sin(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat sinh(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat sqrt(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.x
.ArithmeticException
- If x
is negative.ApfloatRuntimeException
public Apfloat tan(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.x
.ArithmeticException
- If x
is π/2 + n π where n is an integer.ApfloatRuntimeException
public Apfloat tanh(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat agm(Apfloat a, Apfloat b) throws ApfloatRuntimeException
a
- The first operand.b
- The first operand.a
and b
.ApfloatRuntimeException
public Apfloat inverseRoot(Apfloat x, long n) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.n
- Which inverse root to take.x-1/n
.ArithmeticException
- If x
or n
is zero, or x
is negative and n
is even.ApfloatRuntimeException
public Apfloat root(Apfloat x, long n) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.n
- Which root to take.x1/n
.ArithmeticException
- If n
is zero, or x
is negative and n
is even.ApfloatRuntimeException
public Apfloat scale(Apfloat x, long scale) throws ApfloatRuntimeException
x
- The operand.scale
- The amount to move the radix point.x * x.radix()scale
.ApfloatRuntimeException
public Apfloat mod(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x
- The first operand.y
- The second operand.x % y
.ApfloatRuntimeException
public Apfloat ceil(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat floor(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat truncate(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat frac(Apfloat x) throws ApfloatRuntimeException
x
- The operand.x
.ApfloatRuntimeException
public Apfloat round(Apfloat x, RoundingMode roundingMode) throws ApfloatRuntimeException
x
- The operand.roundingMode
- The rounding mode.x
rounded with the specified rounding mode.ApfloatRuntimeException
public Apfloat w(Apfloat x) throws ApfloatRuntimeException
x
- The operand.W0(x)
.ApfloatRuntimeException
public Apfloat toDegrees(Apfloat x) throws ApfloatRuntimeException
x
- The angle in radians.x
converted to degrees.ApfloatRuntimeException
public Apfloat toRadians(Apfloat x) throws ApfloatRuntimeException
x
- The angle in degrees.x
converted to radians.ApfloatRuntimeException
public Apfloat atan2(Apfloat x, Apfloat y) throws ArithmeticException, ApfloatRuntimeException
x
- The operand.y
- The operand.(y, x)
.ArithmeticException
- If x
and y
are zero.ApfloatRuntimeException
public Apfloat copySign(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x
- The number to copy the sign to.y
- The number to copy the sign from.x
with the sign of y
.ApfloatRuntimeException
public Apfloat fmod(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x
- The first operand.y
- The second operand.x % y
.ApfloatRuntimeException
public Apfloat[] modf(Apfloat x) throws ApfloatRuntimeException
x
- The operand.[i, f]
where i
is floor(x)
and f
is x - floor(x)
.ApfloatRuntimeException
public Apfloat factorial(long n) throws ApfloatRuntimeException
n
- The operand.n!
.ApfloatRuntimeException
public Apfloat factorial(long n, int radix) throws ApfloatRuntimeException
n
- The operand.radix
- The radix of the result.n!
.ApfloatRuntimeException
public Apfloat pi() throws ApfloatRuntimeException
π
.ApfloatRuntimeException
public Apfloat pi(int radix) throws NumberFormatException, ApfloatRuntimeException
radix
- The radix of the result.π
.NumberFormatException
- If the radix is invalid.ApfloatRuntimeException
public Apfloat logRadix(int radix) throws NumberFormatException, ApfloatRuntimeException
radix
- The radix of the result.log(radix)
.NumberFormatException
- If the radix is invalid.ApfloatRuntimeException
public Apfloat multiplyAdd(Apfloat a, Apfloat b, Apfloat c, Apfloat d) throws ApfloatRuntimeException
a
- The first operand.b
- The second operand.c
- The third operand.d
- The fourth operand.a * b + c * d
.ApfloatRuntimeException
public Apfloat multiplySubtract(Apfloat a, Apfloat b, Apfloat c, Apfloat d) throws ApfloatRuntimeException
a
- The first operand.b
- The second operand.c
- The third operand.d
- The fourth operand.a * b - c * d
.ApfloatRuntimeException
public Apfloat product(Apfloat... x) throws ApfloatRuntimeException
x
- The operand(s).ApfloatRuntimeException
public Apfloat sum(Apfloat... x) throws ApfloatRuntimeException
x
- The operand(s).ApfloatRuntimeException
Copyright © 2019. All rights reserved.