| Modifier and Type | Class and Description |
|---|---|
| public static enum | DfpField.
Enumerate for rounding modes. |
| Modifier and Type | Field and Description |
|---|---|
| private final Dfp | |
| private final Dfp[] | |
| private static String | eString
High precision string representation of e. |
| public static final int | FLAG_DIV_ZERO
IEEE 854-1987 flag for division by zero. |
| public static final int | FLAG_INEXACT
IEEE 854-1987 flag for inexact result. |
| public static final int | FLAG_INVALID
IEEE 854-1987 flag for invalid operation. |
| public static final int | FLAG_OVERFLOW
IEEE 854-1987 flag for overflow. |
| public static final int | FLAG_UNDERFLOW
IEEE 854-1987 flag for underflow. |
| private int | ieeeFlags
IEEE 854-1987 signals. |
| private final Dfp | |
| private static String | ln10String
High precision string representation of ln(10). |
| private final Dfp | |
| private final Dfp[] | |
| private static String | ln2String
High precision string representation of ln(2). |
| private final Dfp | |
| private final Dfp[] | |
| private static String | ln5String
High precision string representation of ln(5). |
| private final Dfp | |
| private final Dfp | |
| private final Dfp[] | |
| private static String | piString
High precision string representation of π. |
| private final int | radixDigits
The number of radix digits. |
| private DfpField. | rMode
Current rounding mode. |
| private final Dfp | |
| private final Dfp | sqr2Reciprocal
A |
| private static String | sqr2ReciprocalString
High precision string representation of √2 / 2. |
| private final Dfp[] | |
| private static String | sqr2String
High precision string representation of √2. |
| private final Dfp | |
| private final Dfp | sqr3Reciprocal
A |
| private static String | sqr3ReciprocalString
High precision string representation of √3 / 3. |
| private static String | sqr3String
High precision string representation of √3. |
| private final Dfp | |
| private final Dfp |
| Access | Constructor and Description |
|---|---|
| public | DfpField(final int
minimal number of decimal digits. decimalDigits)Create a factory for the specified number of radix digits. |
| private | DfpField(final int
minimal number of decimal digits decimalDigits, final boolean if true, the transcendental constants for the given precision
must be computed (setting this flag to false is RESERVED for the internal recursive call) computeConstants)Create a factory for the specified number of radix digits. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public static Dfp | Returns: exp(a)number for which we want the exponential a, final Dfp constant with value 1 at desired precision one)Compute exp(a). |
| public static Dfp | |
| private static Dfp | |
| private static void | computeStringConstants(final int
precision at which the string constants mus be computed highPrecisionDecimalDigits)Recompute the high precision string constants. |
| public Dfp | |
| public Dfp[] | |
| public int | |
| public Dfp | |
| public Dfp | |
| public Dfp[] | Returns: aDfp with value ln(2) split in two piecesGet the constant ln(2) split in two pieces. |
| public Dfp | |
| public Dfp[] | Returns: aDfp with value ln(5) split in two piecesGet the constant ln(5) split in two pieces. |
| public Dfp | Returns: aDfp with value 1Implements org. Get the constant 1. |
| public Dfp | |
| public Dfp[] | |
| public int | Returns: number of radix digitsGet the number of radix digits of the |
| public DfpField. | |
| public Class | getRuntimeClass()
Implements org. Returns the runtime class of the FieldElement. |
| public Dfp | |
| public Dfp | |
| public Dfp[] | Returns: aDfp with value √2 split in two piecesGet the constant √2 split in two pieces. |
| public Dfp | |
| public Dfp | |
| public Dfp | |
| public Dfp | Returns: aDfp with value 0Implements org. Get the constant 0. |
| public Dfp | |
| public Dfp | |
| public Dfp | |
| public Dfp | |
| public Dfp | |
| public Dfp | |
| public Dfp | |
| public Dfp | |
| public void | |
| public void | setIEEEFlagsBits(final int
bits to set bits)Sets some bits in the IEEE 854 status flags, without changing the already set bits. |
| public void | |
| private Dfp[] |
| e | back to summary |
|---|---|
| private final Dfp e A | |
| eSplit | back to summary |
|---|---|
| private final Dfp[] eSplit A two elements | |
| eString | back to summary |
|---|---|
| private static String eString High precision string representation of e. | |
| FLAG_DIV_ZERO | back to summary |
|---|---|
| public static final int FLAG_DIV_ZERO IEEE 854-1987 flag for division by zero. | |
| FLAG_INEXACT | back to summary |
|---|---|
| public static final int FLAG_INEXACT IEEE 854-1987 flag for inexact result. | |
| FLAG_INVALID | back to summary |
|---|---|
| public static final int FLAG_INVALID IEEE 854-1987 flag for invalid operation. | |
| FLAG_OVERFLOW | back to summary |
|---|---|
| public static final int FLAG_OVERFLOW IEEE 854-1987 flag for overflow. | |
| FLAG_UNDERFLOW | back to summary |
|---|---|
| public static final int FLAG_UNDERFLOW IEEE 854-1987 flag for underflow. | |
| ieeeFlags | back to summary |
|---|---|
| private int ieeeFlags IEEE 854-1987 signals. | |
| ln10 | back to summary |
|---|---|
| private final Dfp ln10 A | |
| ln10String | back to summary |
|---|---|
| private static String ln10String High precision string representation of ln(10). | |
| ln2 | back to summary |
|---|---|
| private final Dfp ln2 A | |
| ln2Split | back to summary |
|---|---|
| private final Dfp[] ln2Split A two elements | |
| ln2String | back to summary |
|---|---|
| private static String ln2String High precision string representation of ln(2). | |
| ln5 | back to summary |
|---|---|
| private final Dfp ln5 A | |
| ln5Split | back to summary |
|---|---|
| private final Dfp[] ln5Split A two elements | |
| ln5String | back to summary |
|---|---|
| private static String ln5String High precision string representation of ln(5). | |
| one | back to summary |
|---|---|
| private final Dfp one A | |
| pi | back to summary |
|---|---|
| private final Dfp pi A | |
| piSplit | back to summary |
|---|---|
| private final Dfp[] piSplit A two elements | |
| piString | back to summary |
|---|---|
| private static String piString High precision string representation of π. | |
| radixDigits | back to summary |
|---|---|
| private final int radixDigits The number of radix digits. Note these depend on the radix which is 10000 digits, so each one is equivalent to 4 decimal digits. | |
| rMode | back to summary |
|---|---|
| private DfpField. Current rounding mode. | |
| sqr2 | back to summary |
|---|---|
| private final Dfp sqr2 A | |
| sqr2Reciprocal | back to summary |
|---|---|
| private final Dfp sqr2Reciprocal A | |
| sqr2ReciprocalString | back to summary |
|---|---|
| private static String sqr2ReciprocalString High precision string representation of √2 / 2. | |
| sqr2Split | back to summary |
|---|---|
| private final Dfp[] sqr2Split A two elements | |
| sqr2String | back to summary |
|---|---|
| private static String sqr2String High precision string representation of √2. | |
| sqr3 | back to summary |
|---|---|
| private final Dfp sqr3 A | |
| sqr3Reciprocal | back to summary |
|---|---|
| private final Dfp sqr3Reciprocal A | |
| sqr3ReciprocalString | back to summary |
|---|---|
| private static String sqr3ReciprocalString High precision string representation of √3 / 3. | |
| sqr3String | back to summary |
|---|---|
| private static String sqr3String High precision string representation of √3. | |
| two | back to summary |
|---|---|
| private final Dfp two A | |
| zero | back to summary |
|---|---|
| private final Dfp zero A | |
| DfpField | back to summary |
|---|---|
| public DfpField(final int decimalDigits) Create a factory for the specified number of radix digits.
Note that since the
| |
| DfpField | back to summary |
|---|---|
| private DfpField(final int decimalDigits, final boolean computeConstants) Create a factory for the specified number of radix digits.
Note that since the
| |
| clearIEEEFlags | back to summary |
|---|---|
| public void clearIEEEFlags() Clears the IEEE 854 status flags. | |
| computeExp | back to summary |
|---|---|
| public static Dfp computeExp(final Dfp a, final Dfp one) Compute exp(a). | |
| computeLn | back to summary |
|---|---|
| public static Dfp computeLn(final Dfp a, final Dfp one, final Dfp two) Compute ln(a). Let f(x) = ln(x), We know that f'(x) = 1/x, thus from Taylor's theorem we have: ----- n+1 n f(x) = \ (-1) (x - 1) / ---------------- for 1 <= n <= infinity ----- n or 2 3 4 (x-1) (x-1) (x-1) ln(x) = (x-1) - ----- + ------ - ------ + ... 2 3 4 alternatively, 2 3 4 x x x ln(x+1) = x - - + - - - + ... 2 3 4 This series can be used to compute ln(x), but it converges too slowly. If we substitute -x for x above, we get 2 3 4 x x x ln(1-x) = -x - - - - - - + ... 2 3 4 Note that all terms are now negative. Because the even powered ones absorbed the sign. Now, subtract the series above from the previous one to get ln(x+1) - ln(1-x). Note the even terms cancel out leaving only the odd ones 3 5 7 2x 2x 2x ln(x+1) - ln(x-1) = 2x + --- + --- + ---- + ... 3 5 7 By the property of logarithms that ln(a) - ln(b) = ln (a/b) we have: 3 5 7 x+1 / x x x \ ln ----- = 2 * | x + ---- + ---- + ---- + ... | x-1 \ 3 5 7 / But now we want to find ln(a), so we need to find the value of x such that a = (x+1)/(x-1). This is easily solved to find that x = (a-1)/(a+1). | |
| computePi | back to summary |
|---|---|
| private static Dfp computePi(final Dfp one, final Dfp two, final Dfp three) Compute π using Jonathan and Peter Borwein quartic formula. | |
| computeStringConstants | back to summary |
|---|---|
| private static void computeStringConstants(final int highPrecisionDecimalDigits) Recompute the high precision string constants.
| |
| getE | back to summary |
|---|---|
| public Dfp getE() Get the constant e. | |
| getESplit | back to summary |
|---|---|
| public Dfp[] getESplit() Get the constant e split in two pieces. | |
| getIEEEFlags | back to summary |
|---|---|
| public int getIEEEFlags() Get the IEEE 854 status flags.
| |
| getLn10 | back to summary |
|---|---|
| public Dfp getLn10() Get the constant ln(10). | |
| getLn2 | back to summary |
|---|---|
| public Dfp getLn2() Get the constant ln(2). | |
| getLn2Split | back to summary |
|---|---|
| public Dfp[] getLn2Split() Get the constant ln(2) split in two pieces. | |
| getLn5 | back to summary |
|---|---|
| public Dfp getLn5() Get the constant ln(5). | |
| getLn5Split | back to summary |
|---|---|
| public Dfp[] getLn5Split() Get the constant ln(5) split in two pieces. | |
| getOne | back to summary |
|---|---|
| public Dfp getOne() Implements org. Get the constant 1. | |
| getPi | back to summary |
|---|---|
| public Dfp getPi() Get the constant π. | |
| getPiSplit | back to summary |
|---|---|
| public Dfp[] getPiSplit() Get the constant π split in two pieces. | |
| getRadixDigits | back to summary |
|---|---|
| public int getRadixDigits() Get the number of radix digits of the
| |
| getRoundingMode | back to summary |
|---|---|
| public DfpField. Get the current rounding mode.
| |
| getRuntimeClass | back to summary |
|---|---|
| public Class Implements org. Doc from org. Returns the runtime class of the FieldElement.
| |
| getSqr2 | back to summary |
|---|---|
| public Dfp getSqr2() Get the constant √2. | |
| getSqr2Reciprocal | back to summary |
|---|---|
| public Dfp getSqr2Reciprocal() Get the constant √2 / 2. | |
| getSqr2Split | back to summary |
|---|---|
| public Dfp[] getSqr2Split() Get the constant √2 split in two pieces. | |
| getSqr3 | back to summary |
|---|---|
| public Dfp getSqr3() Get the constant √3. | |
| getSqr3Reciprocal | back to summary |
|---|---|
| public Dfp getSqr3Reciprocal() Get the constant √3 / 3. | |
| getTwo | back to summary |
|---|---|
| public Dfp getTwo() Get the constant 2. | |
| getZero | back to summary |
|---|---|
| public Dfp getZero() Implements org. Get the constant 0. | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp() Makes a | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp(final byte x) Create an instance from a byte value. | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp(final int x) Create an instance from an int value. | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp(final long x) Create an instance from a long value. | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp(final double x) Create an instance from a double value. | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp(Dfp d) Copy constructor. | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp(final String s) Create a | |
| newDfp | back to summary |
|---|---|
| public Dfp newDfp(final byte sign, final byte nans) Creates a
| |
| setIEEEFlags | back to summary |
|---|---|
| public void setIEEEFlags(final int flags) Sets the IEEE 854 status flags.
| |
| setIEEEFlagsBits | back to summary |
|---|---|
| public void setIEEEFlagsBits(final int bits) Sets some bits in the IEEE 854 status flags, without changing the already set bits.
Calling this method is equivalent to call
| |
| setRoundingMode | back to summary |
|---|---|
| public void setRoundingMode(final DfpField. Set the rounding mode.
If not set, the default value is
| |
| split | back to summary |
|---|---|
| private Dfp[] split(final String a) Breaks a string representation up into two | |
| Modifier and Type | Field and Description |
|---|---|
| public static final DfpField. | ROUND_CEIL
Rounds towards positive infinity. |
| public static final DfpField. | ROUND_DOWN
Rounds toward zero (truncation). |
| public static final DfpField. | ROUND_FLOOR
Rounds towards negative infinity. |
| public static final DfpField. | ROUND_HALF_DOWN
Rounds towards nearest unless both are equidistant in which case it rounds toward zero. |
| public static final DfpField. | ROUND_HALF_EVEN
Rounds towards nearest unless both are equidistant in which case it rounds toward the even neighbor. |
| public static final DfpField. | ROUND_HALF_ODD
Rounds towards nearest unless both are equidistant in which case it rounds toward the odd neighbor. |
| public static final DfpField. | ROUND_HALF_UP
Rounds towards nearest unless both are equidistant in which case it rounds away from zero. |
| public static final DfpField. | ROUND_UP
Rounds away from zero if discarded digit is non-zero. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static DfpField. | |
| public static DfpField. |
| ROUND_CEIL | back to summary |
|---|---|
| public static final DfpField. Rounds towards positive infinity. | |
| ROUND_DOWN | back to summary |
|---|---|
| public static final DfpField. Rounds toward zero (truncation). | |
| ROUND_FLOOR | back to summary |
|---|---|
| public static final DfpField. Rounds towards negative infinity. | |
| ROUND_HALF_DOWN | back to summary |
|---|---|
| public static final DfpField. Rounds towards nearest unless both are equidistant in which case it rounds toward zero. | |
| ROUND_HALF_EVEN | back to summary |
|---|---|
| public static final DfpField. Rounds towards nearest unless both are equidistant in which case it rounds toward the even neighbor. This is the default as specified by IEEE 854-1987 | |
| ROUND_HALF_ODD | back to summary |
|---|---|
| public static final DfpField. Rounds towards nearest unless both are equidistant in which case it rounds toward the odd neighbor. | |
| ROUND_HALF_UP | back to summary |
|---|---|
| public static final DfpField. Rounds towards nearest unless both are equidistant in which case it rounds away from zero. | |
| ROUND_UP | back to summary |
|---|---|
| public static final DfpField. Rounds away from zero if discarded digit is non-zero. | |
| RoundingMode | back to summary |
|---|---|
| private RoundingMode() | |
| valueOf | back to summary |
|---|---|
| public static DfpField. | |
| values | back to summary |
|---|---|
| public static DfpField. | |