public abstract class DigitSet extends RationalNumber
DigitSet number is the sum of:
digits[0] * radixexponent
digits[1] * radixexponent - 1
digits[2] * radixexponent - 2
...
digits[precision - 1] * radixexponent - (precision - 1)
MAXIMUM_RADIXROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_UP| Modifier | Constructor and Description |
|---|---|
protected |
DigitSet(IntegerNumber[] parts,
java.lang.String asString)
Creates a new
DigitSet instance. |
| Modifier and Type | Method and Description |
|---|---|
abstract int[] |
getDigits()
Returns a new array containing all the digits.
|
abstract int |
getExponent()
Returns the exponent.
|
abstract int |
getPrecision()
Returns the precision, the total number of digits.
|
abstract int |
getRadix()
Returns the radix or base.
|
DigitSet |
toPrecision(int precision)
Returns a digit set with the specified precision.
|
protected abstract DigitSet |
toPrecisionImpl(int precision)
Returns a digit set with the specified precision, actual implementation.
|
add, add, compareTo, compareToImpl, compareToImpl, compareToImpl2, divide, divide, doubleValue, getDenominator, getNumerator, invert, multiply, multiply, negate, pow, powImpl, powImpl, subtract, subtract, toBigDecimal, toBigDecimal, truncabs, byteValue, compareTo, compareTo, equals, fitsByte, fitsDouble, fitsFloat, fitsInt, fitsLong, fitsShort, floatValue, getSign, intValue, longValue, pow, round, shortValue, toBigInteger, toStringprotected DigitSet(IntegerNumber[] parts, java.lang.String asString) throws java.lang.IllegalArgumentException
DigitSet instance.parts - an array containing the numerator and denonimator, not
null, having at least 2 elements and not having a
null at index 0 or 1.asString - textual presentation of this number, not null.java.lang.IllegalArgumentException - if asString == null.public abstract int getRadix()
public abstract int getExponent()
public abstract int[] getDigits()
int value between 0 (inclusive) and
the radix (exclusive).r != null &&
r[i] >= 0 &&
r[i] < getRadix(),
where r is the return value and i is an
int between 0 and r.length.public abstract int getPrecision()
public final DigitSet toPrecision(int precision) throws java.lang.IllegalArgumentException
this) will be returned.
No rounding will be performed, only truncation. If the specified
precision is smaller than the precision of this DigitSet,
then some of the digits will just be removed.
This method calls toPrecisionImpl(int) after checking the
preconditions. If that method returns an invalid value, then an
InternalError is thrown.precision - the precision, >= 1.DigitSet that is equal to this number, truncated to
the specified precision, never null.java.lang.IllegalArgumentException - if precision < 1.protected abstract DigitSet toPrecisionImpl(int precision)
toPrecision(int).precision - the precision, guaranteed to be >= 1 and <
getPrecision().DigitSet that is equal to this number, truncated to
the specified precision.