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, wpublic 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.ApfloatRuntimeExceptionpublic Apfloat add(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x - The first operand.y - The second operand.x + y.ApfloatRuntimeExceptionpublic Apfloat subtract(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x - The first operand.y - The second operand.x - y.ApfloatRuntimeExceptionpublic Apfloat multiply(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x - The first operand.y - The second operand.x * y.ApfloatRuntimeExceptionpublic Apfloat divide(Apfloat x, Apfloat y) throws ArithmeticException, ApfloatRuntimeException
x - The first operand.y - The second operand.x / y.ArithmeticException - If y is zero.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic Apfloat abs(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat acos(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x - The operand.x.ArithmeticException - If the absolute value of x is more than one.ApfloatRuntimeExceptionpublic Apfloat acosh(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x - The operand.x.ArithmeticException - If the x is less than one.ApfloatRuntimeExceptionpublic Apfloat asin(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x - The operand.x.ArithmeticException - If the absolute value of x is more than one.ApfloatRuntimeExceptionpublic Apfloat asinh(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat atan(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic Apfloat cbrt(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat cos(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat cosh(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat exp(Apfloat x) throws ApfloatRuntimeException
x - The operand.ex.ApfloatRuntimeExceptionpublic Apfloat log(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x - The operand.x.ArithmeticException - If x is less than or equal to zero.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic Apfloat sin(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat sinh(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat sqrt(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x - The operand.x.ArithmeticException - If x is negative.ApfloatRuntimeExceptionpublic Apfloat tan(Apfloat x) throws ArithmeticException, ApfloatRuntimeException
x - The operand.x.ArithmeticException - If x is π/2 + n π where n is an integer.ApfloatRuntimeExceptionpublic Apfloat tanh(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat agm(Apfloat a, Apfloat b) throws ApfloatRuntimeException
a - The first operand.b - The first operand.a and b.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic Apfloat scale(Apfloat x, long scale) throws ApfloatRuntimeException
x - The operand.scale - The amount to move the radix point.x * x.radix()scale.ApfloatRuntimeExceptionpublic Apfloat mod(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x - The first operand.y - The second operand.x % y.ApfloatRuntimeExceptionpublic Apfloat ceil(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat floor(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat truncate(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat frac(Apfloat x) throws ApfloatRuntimeException
x - The operand.x.ApfloatRuntimeExceptionpublic Apfloat round(Apfloat x, RoundingMode roundingMode) throws ApfloatRuntimeException
x - The operand.roundingMode - The rounding mode.x rounded with the specified rounding mode.ApfloatRuntimeExceptionpublic Apfloat w(Apfloat x) throws ApfloatRuntimeException
x - The operand.W0(x).ApfloatRuntimeExceptionpublic Apfloat toDegrees(Apfloat x) throws ApfloatRuntimeException
x - The angle in radians.x converted to degrees.ApfloatRuntimeExceptionpublic Apfloat toRadians(Apfloat x) throws ApfloatRuntimeException
x - The angle in degrees.x converted to radians.ApfloatRuntimeExceptionpublic Apfloat atan2(Apfloat x, Apfloat y) throws ArithmeticException, ApfloatRuntimeException
x - The operand.y - The operand.(y, x).ArithmeticException - If x and y are zero.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic Apfloat fmod(Apfloat x, Apfloat y) throws ApfloatRuntimeException
x - The first operand.y - The second operand.x % y.ApfloatRuntimeExceptionpublic Apfloat[] modf(Apfloat x) throws ApfloatRuntimeException
x - The operand.[i, f] where i is floor(x) and f is x - floor(x).ApfloatRuntimeExceptionpublic Apfloat factorial(long n) throws ApfloatRuntimeException
n - The operand.n!.ApfloatRuntimeExceptionpublic Apfloat factorial(long n, int radix) throws ApfloatRuntimeException
n - The operand.radix - The radix of the result.n!.ApfloatRuntimeExceptionpublic Apfloat pi() throws ApfloatRuntimeException
π.ApfloatRuntimeExceptionpublic Apfloat pi(int radix) throws NumberFormatException, ApfloatRuntimeException
radix - The radix of the result.π.NumberFormatException - If the radix is invalid.ApfloatRuntimeExceptionpublic Apfloat logRadix(int radix) throws NumberFormatException, ApfloatRuntimeException
radix - The radix of the result.log(radix).NumberFormatException - If the radix is invalid.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic 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.ApfloatRuntimeExceptionpublic Apfloat product(Apfloat... x) throws ApfloatRuntimeException
x - The operand(s).ApfloatRuntimeExceptionpublic Apfloat sum(Apfloat... x) throws ApfloatRuntimeException
x - The operand(s).ApfloatRuntimeExceptionCopyright © 2025. All rights reserved.