enum SpecialPowResult extends Enum<SpecialPowResult>
Enum Constant and Description |
---|
BASE_IS_MINUS_ONE
a^n with a==-1 leading to 1 if n is even
and to -1 if n is odd. |
BASE_IS_ONE
a^n with a==1 leading to 1 |
BASE_IS_ZERO
a^n with a==0 leading to 0 if n>=0 and to
an arithmetic exception if n<0 |
EXPONENT_IS_MINUS_ONE
a^n with n==-1 leading to 1/a |
EXPONENT_IS_ONE
a^n with n==1 leading to a |
EXPONENT_IS_TWO
a^n with n==2 leading to square(a) |
EXPONENT_IS_ZERO
a^n with n==0 leading to 1 |
Modifier and Type | Method and Description |
---|---|
(package private) static SpecialPowResult |
getFor(DecimalArithmetic arithmetic,
long uDecimal,
long n)
Returns the special power case if it is one and null otherwise.
|
(package private) abstract long |
pow(DecimalArithmetic arithmetic,
long uDecimal,
int exponent)
Performs the exponentiation for this special pow result.
|
static SpecialPowResult |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SpecialPowResult[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SpecialPowResult EXPONENT_IS_ZERO
a^n
with n==0
leading to 1
public static final SpecialPowResult EXPONENT_IS_ONE
a^n
with n==1
leading to a
public static final SpecialPowResult BASE_IS_ZERO
a^n
with a==0
leading to 0
if n>=0
and to
an arithmetic exception if n<0
public static final SpecialPowResult BASE_IS_ONE
a^n
with a==1
leading to 1
public static final SpecialPowResult BASE_IS_MINUS_ONE
a^n
with a==-1
leading to 1
if n
is even
and to -1
if n
is odd.public static final SpecialPowResult EXPONENT_IS_MINUS_ONE
a^n
with n==-1
leading to 1/a
public static final SpecialPowResult EXPONENT_IS_TWO
a^n
with n==2
leading to square(a)
public static SpecialPowResult[] values()
for (SpecialPowResult c : SpecialPowResult.values()) System.out.println(c);
public static SpecialPowResult valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullabstract long pow(DecimalArithmetic arithmetic, long uDecimal, int exponent)
arithmetic
- the arithmetic associated with the valuesuDecimal
- the base valueexponent
- the exponentArithmeticException
- if uDecimal==0
and exponent is negative or if an
overflow occurs and the arithmetic's OverflowMode
is
set to throw an exceptionstatic final SpecialPowResult getFor(DecimalArithmetic arithmetic, long uDecimal, long n)
arithmetic
- the arithmetic objectuDecimal
- the basen
- the exponent