AdvancedDoubleDoubleMath Class |
Namespace: Meta.Numerics.Extended
The AdvancedDoubleDoubleMath type exposes the following members.
Name | Description | |
---|---|---|
Erf |
Computes the error function with double double precision.
| |
Erfc |
Computes the complementary error function with double double precision.
| |
LogGamma |
Computes the logarithm of the Gamma function with double double precision.
|
Name | Description | |
---|---|---|
EulerGamma |
The double double value of Euler's gamma.
|
In order to take advantage of the increased accurary of these functions over the corresponding Double-based functions, you must ensure that the arguments you provide are also more accurate than Double. Because decimal numbers expressed in code are automatically intrepreted by the compiler as Double, it's easier than you might think do this wrong. For example, invoking Gamma(0.2) will not compute Γ(1/5) to DoubleDouble precision. The reason is that 0.2 is intrepreted by the compiler as a Double, and there is no Double value that is precisely 1/5. Instead, 0.2 parsed as a Double, is stored as 3602879701896397 X 2-54 = 0.20000000000000001110223024625157... This equals 0.2 to within the 16 decimal-place accuracy of Double, but clearly not to within the 32 decimal-place accuracy of DoubleDouble.
There are a number of ways to ensure that you are providing an argument to DoubleDouble accuracy. One possibility is to use the DoubleDouble text parser, for example by invoking new DoubleDouble("0.2"). Another is to produce tha argument as the result of calculation from exact integers, (DoubleDouble) 1 / 5, which works because 1 and 5 (like all integers within range) are represented exactly and the because of the cast the division operation is Division(DoubleDouble, DoubleDouble). (The stored value in these cases is again not precisely 1/5, but is equal within the accuracy of DoubleDouble.) Finally, if you know that the argument you want is precisely represetable as a Double, you can safely use the compiler's parser. For example, invoking Gamma(0.25) does compute Γ(1/4) to DoubleDouble precision, because 1/4 is exactly representable by Double.