|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.dfp.DfpMath
public class DfpMath
Mathematical routines for use with Dfp
.
The constants are defined in DfpField
Method Summary | |
---|---|
static Dfp |
acos(Dfp a)
computes the arc-cosine of the argument. |
static Dfp |
asin(Dfp a)
computes the arc-sine of the argument. |
static Dfp |
atan(Dfp a)
computes the arc tangent of the argument Uses the typical taylor series but may reduce arguments using the following identity tan(x+y) = (tan(x) + tan(y)) / (1 - tan(x)*tan(y)) since tan(PI/8) = sqrt(2)-1, atan(x) = atan( (x - sqrt(2) + 1) / (1+x*sqrt(2) - x) + PI/8.0 |
protected static Dfp |
atanInternal(Dfp a)
computes the arc-tangent of the argument. |
static Dfp |
cos(Dfp a)
computes the cosine of the argument. |
protected static Dfp |
cosInternal(Dfp[] a)
Computes cos(a) Used when 0 < a < pi/4. |
static Dfp |
exp(Dfp a)
Computes e to the given power. |
protected static Dfp |
expInternal(Dfp a)
Computes e to the given power. |
static Dfp |
log(Dfp a)
Returns the natural logarithm of a. |
protected static Dfp[] |
logInternal(Dfp[] a)
Computes the natural log of a number between 0 and 2. |
static Dfp |
pow(Dfp x,
Dfp y)
Computes x to the y power. |
static Dfp |
pow(Dfp base,
int a)
Raises base to the power a by successive squaring. |
static Dfp |
sin(Dfp a)
computes the sine of the argument. |
protected static Dfp |
sinInternal(Dfp[] a)
Computes sin(a) Used when 0 < a < pi/4. |
protected static Dfp[] |
split(Dfp a)
Splits a Dfp into 2 Dfp 's such that their sum is equal to the input Dfp . |
protected static Dfp[] |
split(DfpField field,
String a)
Breaks a string representation up into two dfp's. |
protected static Dfp[] |
splitDiv(Dfp[] a,
Dfp[] b)
Divide two numbers that are split in to two pieces that are meant to be added together. |
protected static Dfp[] |
splitMult(Dfp[] a,
Dfp[] b)
Multiply two numbers that are split in to two pieces that are meant to be added together. |
protected static Dfp |
splitPow(Dfp[] base,
int a)
Raise a split base to the a power. |
static Dfp |
tan(Dfp a)
computes the tangent of the argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected static Dfp[] split(DfpField field, String a)
The two dfp are such that the sum of them is equivalent to the input string, but has higher precision than using a single dfp. This is useful for improving accuracy of exponentiation and critical multiplies.
field
- field to which the Dfp must belonga
- string representation to split
Dfp
which sum is aprotected static Dfp[] split(Dfp a)
Dfp
into 2 Dfp
's such that their sum is equal to the input Dfp
.
a
- number to split
protected static Dfp[] splitMult(Dfp[] a, Dfp[] b)
a
- first factor of the multiplication, in split formb
- second factor of the multiplication, in split form
protected static Dfp[] splitDiv(Dfp[] a, Dfp[] b)
a
- dividend, in split formb
- divisor, in split form
protected static Dfp splitPow(Dfp[] base, int a)
base
- number to raisea
- power
public static Dfp pow(Dfp base, int a)
base
- number to raisea
- power
public static Dfp exp(Dfp a)
a
- power at which e should be raised
protected static Dfp expInternal(Dfp a)
a
- power at which e should be raised
public static Dfp log(Dfp a)
a
- number from which logarithm is requested
protected static Dfp[] logInternal(Dfp[] a)
a
- number from which logarithm is requested, in split form
public static Dfp pow(Dfp x, Dfp y)
Uses the following method:
Special Cases
x
- base to be raisedy
- power to which base should be raised
protected static Dfp sinInternal(Dfp[] a)
a
- number from which sine is desired, in split form
protected static Dfp cosInternal(Dfp[] a)
a
- number from which cosine is desired, in split form
public static Dfp sin(Dfp a)
a
- number from which sine is desired
public static Dfp cos(Dfp a)
a
- number from which cosine is desired
public static Dfp tan(Dfp a)
a
- number from which tangent is desired
protected static Dfp atanInternal(Dfp a)
a
- number from which arc-tangent is desired
public static Dfp atan(Dfp a)
a
- number from which arc-tangent is desired
public static Dfp asin(Dfp a)
a
- number from which arc-sine is desired
public static Dfp acos(Dfp a)
a
- number from which arc-cosine is desired
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |