public class Power extends AbstractCompositeNumber
MAXIMUM_RADIXROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_UP| Modifier | Constructor and Description |
|---|---|
protected |
Power(RealNumber base,
RealNumber exponent)
Constructs a
Power with the specified base and exponent. |
| Modifier and Type | Method and Description |
|---|---|
static Power |
createInstance(RealNumber base,
RealNumber exponent)
Returns a
Power with the specified operands. |
protected static int |
determineSign(RealNumber base,
RealNumber exponent)
Computes the sign of a power with the specified operands.
|
RealNumber |
getBase()
Returns the base of this power.
|
RealNumber |
getExponent()
Returns the exponent of this power.
|
java.math.BigDecimal |
toBigDecimal(int precision,
int roundingMode)
Converts the value of this number to a
BigDecimal with the
specified precision and rounding mode. |
IntegerNumber |
trunc()
Rounds to an integer number towards 0.
|
getElement, getElementCount, getElementsabs, add, byteValue, compareTo, compareTo, compareToImpl, divide, doubleValue, equals, fitsByte, fitsDouble, fitsFloat, fitsInt, fitsLong, fitsShort, floatValue, getSign, intValue, invert, longValue, multiply, negate, pow, powImpl, round, shortValue, subtract, toBigDecimal, toBigInteger, toStringprotected Power(RealNumber base, RealNumber exponent) throws java.lang.IllegalArgumentException
Power with the specified base and exponent.base - the base for the power, not null.exponent - the exponent for the power, not null.java.lang.IllegalArgumentException - if base == null || exponent == null.public static Power createInstance(RealNumber base, RealNumber exponent) throws java.lang.IllegalArgumentException
Power with the specified operands.base - the base for the power, not null.exponent - the exponent for the power, not null.Power instance, possibly newly constructed.java.lang.IllegalArgumentException - if base == null || exponent == null.protected static int determineSign(RealNumber base, RealNumber exponent) throws java.lang.IllegalArgumentException
base - the base for the power, not null.exponent - the exponent for the power, not null.Power instance, possibly newly constructed.java.lang.IllegalArgumentException - if base == null || exponent == null.public RealNumber getBase()
null.public RealNumber getExponent()
null.public java.math.BigDecimal toBigDecimal(int precision,
int roundingMode)
throws java.lang.IllegalArgumentException
RealNumberBigDecimal with the
specified precision and rounding mode.toBigDecimal in class RealNumberprecision - the number of digits behind the decimal point, >= 0.roundingMode - the rounding mode to use, one of the modes defined in class
BigDecimal.BigDecimal with the rounded value of this, never
null.java.lang.IllegalArgumentException - if one of the following applies:
BigDecimalpublic IntegerNumber trunc()
RealNumbertrunc in class RealNumbernull.