public class AprationalMath extends Object
Modifier and Type | Method and Description |
---|---|
static Aprational |
abs(Aprational x)
Absolute value.
|
static Aprational |
copySign(Aprational x,
Aprational y)
Copy sign from one argument to another.
|
static Aprational |
negate(Aprational x)
Deprecated.
Use
Aprational.negate() . |
static Aprational |
pow(Aprational x,
long n)
Integer power.
|
static Aprational |
product(Aprational... x)
Product of numbers.
|
static Apfloat |
round(Aprational x,
long precision,
RoundingMode roundingMode)
Rounds the given number to the specified precision with the specified rounding mode.
|
static Aprational |
scale(Aprational x,
long scale)
Multiply by a power of the radix.
|
static Aprational |
sum(Aprational... x)
Sum of numbers.
|
public static Aprational pow(Aprational x, long n) throws ArithmeticException, ApfloatRuntimeException
x
- Base of the power operator.n
- Exponent of the power operator.x
to the n
:th power, that is xn
.ArithmeticException
- If both x
and n
are zero.ApfloatRuntimeException
@Deprecated public static Aprational negate(Aprational x) throws ApfloatRuntimeException
Aprational.negate()
.-x
.x
- The argument.-x
.ApfloatRuntimeException
public static Aprational abs(Aprational x) throws ApfloatRuntimeException
x
- The argument.x
.ApfloatRuntimeException
public static Aprational copySign(Aprational x, Aprational y) throws ApfloatRuntimeException
x
- The value whose sign is to be adjusted.y
- The value whose sign is to be used.x
with its sign changed to match the sign of y
.ApfloatRuntimeException
public static Aprational scale(Aprational x, long scale) throws ApfloatRuntimeException
x
- The argument.scale
- The scaling factor.x * x.radix()scale
.ApfloatRuntimeException
public static Apfloat round(Aprational x, long precision, RoundingMode roundingMode) throws IllegalArgumentException, ArithmeticException, ApfloatRuntimeException
x
- The number to round.precision
- The precision to round to.roundingMode
- The rounding mode to use.IllegalArgumentException
- If precision
is less than zero or zero.ArithmeticException
- If rounding is necessary (result is not exact) and rounding mode is RoundingMode.UNNECESSARY
.ApfloatRuntimeException
public static Aprational product(Aprational... x) throws ApfloatRuntimeException
If there are no arguments, the return value is 1
.
x
- The argument(s).ApfloatRuntimeException
public static Aprational sum(Aprational... x) throws ApfloatRuntimeException
If there are no arguments, the return value is 0
.
x
- The argument(s).ApfloatRuntimeException
Copyright © 2017. All rights reserved.