This class does not handle negative numbers or zero.
The value of a NormalisedDecimal is given by
significand × 10decimalExponent
where:
significand = wholePart + fractionalPart / 224
| Modifier and Type | Field and Description |
|---|---|
| private final int | _fractionalPart
The fractional part of the significand. |
| private final int | _relativeDecimalExponent
The decimal exponent increased by one less than the digit count of |
| private final long | _wholePart
The whole part of the significand (typically 15 digits). |
| private static final BigDecimal | |
| private static final int | C_2_POW_19
219 |
| private static final int | EXPONENT_OFFSET
Number of powers of ten contained in the significand |
| private static final int | FRAC_HALF
the value of |
| private static final int | LOG_BASE_10_OF_2_TIMES_2_POW_20
log10(2)×220 |
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| pack-priv BigInteger | Returns: the significand as a fixed point number (with 24 fraction bits and 47-50 whole bits)
|
| public static NormalisedDecimal | |
| public int | Returns: the number of powers of 10 which have been extracted from the significand and binary exponent.
|
| private String | |
| public BigDecimal | |
| public String | |
| public String | getSignificantDecimalDigitsLastDigitRounded()
Rounds the first whole digit position (considers only units digit, not frational part). |
| public ExpandedDouble | Returns: a new NormalisedDecimal normalised to base 2 representation.Convert to an equivalent |
| public NormalisedDecimal | |
| public String |
| _fractionalPart | back to summary |
|---|---|
| private final int _fractionalPart The fractional part of the significand. 24 bits (only top 14-17 bits significant): a value between 0x000000 and 0xFFFF80 | |
| _relativeDecimalExponent | back to summary |
|---|---|
| private final int _relativeDecimalExponent The decimal exponent increased by one less than the digit count of | |
| _wholePart | back to summary |
|---|---|
| private final long _wholePart The whole part of the significand (typically 15 digits). 47-50 bits long (MSB may be anywhere from bit 46 to 49) LSB is units bit. | |
| BD_2_POW_24 | back to summary |
|---|---|
| private static final BigDecimal BD_2_POW_24 | |
| C_2_POW_19 | back to summary |
|---|---|
| private static final int C_2_POW_19 219 | |
| EXPONENT_OFFSET | back to summary |
|---|---|
| private static final int EXPONENT_OFFSET Number of powers of ten contained in the significand | |
| FRAC_HALF | back to summary |
|---|---|
| private static final int FRAC_HALF the value of | |
| LOG_BASE_10_OF_2_TIMES_2_POW_20 | back to summary |
|---|---|
| private static final int LOG_BASE_10_OF_2_TIMES_2_POW_20 log10(2)×220 | |
| MAX_REP_WHOLE_PART | back to summary |
|---|---|
| private static final long MAX_REP_WHOLE_PART 1015 | |
| NormalisedDecimal | back to summary |
|---|---|
| pack-priv NormalisedDecimal(long wholePart, int fracPart, int decimalExponent) | |
| compareNormalised | back to summary |
|---|---|
| public int compareNormalised(NormalisedDecimal other) assumes both this and other are normalised | |
| composeFrac | back to summary |
|---|---|
pack-priv BigInteger composeFrac()
| |
| create | back to summary |
|---|---|
public static NormalisedDecimal create(BigInteger frac, int binaryExponent)
| |
| getDecimalExponent | back to summary |
|---|---|
public int getDecimalExponent()
| |
| getFractionalDigits | back to summary |
|---|---|
| private String getFractionalDigits() | |
| getFractionalPart | back to summary |
|---|---|
| public BigDecimal getFractionalPart() | |
| getSignificantDecimalDigits | back to summary |
|---|---|
| public String getSignificantDecimalDigits() | |
| getSignificantDecimalDigitsLastDigitRounded | back to summary |
|---|---|
| public String getSignificantDecimalDigitsLastDigitRounded() Rounds the first whole digit position (considers only units digit, not frational part). Caller should check total digit count of result to see whether the rounding operation caused a carry out of the most significant digit | |
| normaliseBaseTwo | back to summary |
|---|---|
| public ExpandedDouble normaliseBaseTwo() Convert to an equivalent
| |
| roundUnits | back to summary |
|---|---|
| public NormalisedDecimal roundUnits() Rounds at the digit with value 10decimalExponent | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |