|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apfloat.ApintMath
public class ApintMath
Various mathematical functions for arbitrary precision integers.
| Method Summary | |
|---|---|
static Apint |
abs(Apint x)
Absolute value. |
static Apint[] |
cbrt(Apint x)
Cube root and remainder. |
static Apint |
copySign(Apint x,
Apint y)
Copy sign from one argument to another. |
static Apint[] |
div(Apint x,
Apint y)
Quotient and remainder. |
static Apint |
factorial(long n)
Factorial function. |
static Apint |
factorial(long n,
int radix)
Factorial function. |
static Apint |
gcd(Apint a,
Apint b)
Greatest common divisor. |
static Apint |
lcm(Apint a,
Apint b)
Least common multiple. |
static Apint |
modMultiply(Apint a,
Apint b,
Apint m)
Modular multiplication. |
static Apint |
modPow(Apint a,
Apint b,
Apint m)
Modular power. |
static Apint |
negate(Apint x)
Deprecated. Use Apint.negate(). |
static Apint |
pow(Apint x,
long n)
Integer power. |
static Apint |
product(Apint... x)
Product of numbers. |
static Apint[] |
root(Apint x,
long n)
Positive integer root and remainder. |
static Apint |
scale(Apint x,
long scale)
Multiply by a power of the radix. |
static Apint[] |
sqrt(Apint x)
Square root and remainder. |
static Apint |
sum(Apint... x)
Sum of numbers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Apint pow(Apint 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
public static Apint[] sqrt(Apint x)
throws ArithmeticException,
ApfloatRuntimeException
x - The argument.
[q, r], where q2 + r = x.
ArithmeticException - If x is negative.
ApfloatRuntimeException
public static Apint[] cbrt(Apint x)
throws ApfloatRuntimeException
x - The argument.
[q, r], where q3 + r = x.
ApfloatRuntimeException
public static Apint[] root(Apint x,
long n)
throws ArithmeticException,
ApfloatRuntimeException
Returns the n:th root of x,
that is x1/n, rounded towards zero.
x - The argument.n - Which root to take.
[q, r], where qn + r = x.
ArithmeticException - If n and x are zero, or x is negative and n is even.
ApfloatRuntimeException
@Deprecated
public static Apint negate(Apint x)
throws ApfloatRuntimeException
Apint.negate().
-x.
x - The argument.
-x.
ApfloatRuntimeException
public static Apint abs(Apint x)
throws ApfloatRuntimeException
x - The argument.
x.
ApfloatRuntimeException
public static Apint copySign(Apint x,
Apint 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 Apint scale(Apint x,
long scale)
throws ApfloatRuntimeException
x - The argument.scale - The scaling factor.
x * x.radix()scale.
ApfloatRuntimeException
public static Apint[] div(Apint x,
Apint y)
throws ArithmeticException,
ApfloatRuntimeException
x - The dividend.y - The divisor.
[quotient, remainder], that is [x / y, x % y].
ArithmeticException - In case the divisor is zero.
ApfloatRuntimeException
public static Apint gcd(Apint a,
Apint b)
throws ApfloatRuntimeException
a
and b is negative.
a - First argument.b - Second argument.
a and b.
ApfloatRuntimeException
public static Apint lcm(Apint a,
Apint b)
throws ApfloatRuntimeException
a
and b is negative.
a - First argument.b - Second argument.
a and b.
ApfloatRuntimeException
public static Apint modMultiply(Apint a,
Apint b,
Apint m)
throws ApfloatRuntimeException
a * b % m
a - First argument.b - Second argument.m - Modulus.
a * b mod m
ApfloatRuntimeException
public static Apint modPow(Apint a,
Apint b,
Apint m)
throws ApfloatRuntimeException
a - Base.b - Exponent. Should be non-negative, since the modulus can't be factorized with this implementation.m - Modulus.
ab mod m
ApfloatRuntimeException
public static Apint factorial(long n)
throws ArithmeticException,
NumberFormatException,
ApfloatRuntimeException
n - The number whose factorial is to be calculated. Should be non-negative.
n!
ArithmeticException - If n is negative.
NumberFormatException - If the default radix is not valid.
ApfloatRuntimeException
public static Apint factorial(long n,
int radix)
throws ArithmeticException,
NumberFormatException,
ApfloatRuntimeException
n - The number whose factorial is to be calculated. Should be non-negative.radix - The radix to use.
n!
ArithmeticException - If n is negative.
NumberFormatException - If the radix is not valid.
ApfloatRuntimeException
public static Apint product(Apint... x)
throws ApfloatRuntimeException
If there are no arguments, the return value is 1.
x - The argument(s).
ApfloatRuntimeException
public static Apint sum(Apint... x)
throws ApfloatRuntimeException
If there are no arguments, the return value is 0.
x - The argument(s).
ApfloatRuntimeException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||