|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
org.znerd.math.RealNumber
org.znerd.math.CompositeNumber
org.znerd.math.AbstractCompositeNumber
org.znerd.math.Power
A power, consisting of a base and an exponent.
Field Summary |
Fields inherited from class org.znerd.math.RealNumber |
MAXIMUM_RADIX |
Fields inherited from interface org.znerd.math.RoundingModes |
ROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_UP |
Constructor Summary | |
protected |
Power(RealNumber base,
RealNumber exponent)
Constructs a Power with the specified base and exponent. |
Method Summary | |
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. |
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. |
Methods inherited from class org.znerd.math.AbstractCompositeNumber |
getElement, getElementCount, getElements |
Methods inherited from class org.znerd.math.RealNumber |
abs, 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, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Power(RealNumber base, RealNumber exponent) throws IllegalArgumentException
Power
with the specified base and exponent.
base
- the base for the power, not null
.exponent
- the exponent for the power, not null
.
IllegalArgumentException
- if base == null || exponent == null
.Method Detail |
public static Power createInstance(RealNumber base, RealNumber exponent) throws 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.
IllegalArgumentException
- if base == null || exponent == null
.protected static int determineSign(RealNumber base, RealNumber exponent) throws IllegalArgumentException
base
- the base for the power, not null
.exponent
- the exponent for the power, not null
.
Power
instance, possibly newly constructed.
IllegalArgumentException
- if base == null || exponent == null
.public RealNumber getBase()
null
.public RealNumber getExponent()
null
.public BigDecimal toBigDecimal(int precision, int roundingMode) throws IllegalArgumentException
RealNumber
BigDecimal
with the
specified precision and rounding mode.
toBigDecimal
in class RealNumber
precision
- 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
.
IllegalArgumentException
- if one of the following applies:
BigDecimal
public IntegerNumber trunc()
RealNumber
trunc
in class RealNumber
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |