Difference between revisions of "Category:ApCoCoA-1:Package elemfns"
S schuster (talk | contribs) |
S schuster (talk | contribs) |
||
Line 1: | Line 1: | ||
− | Please note that this package is in beta status. This means, that function names | + | Please note that this package is in beta status. This means, that function names may be subject to changes in future releases. |
The package <code>$apcocoa/elemfns</code> (alias <code>Fn</code>) provides a fixed point software implementation of common elementary functions and constants with arbitrary accuracy and correct rounding in the following sense: | The package <code>$apcocoa/elemfns</code> (alias <code>Fn</code>) provides a fixed point software implementation of common elementary functions and constants with arbitrary accuracy and correct rounding in the following sense: |
Revision as of 14:01, 4 May 2011
Please note that this package is in beta status. This means, that function names may be subject to changes in future releases.
The package $apcocoa/elemfns
(alias Fn
) provides a fixed point software implementation of common elementary functions and constants with arbitrary accuracy and correct rounding in the following sense:
Let f be a mathematical function and F be its implementation, let N (the accuracy) be a positive integer and X be a rational number in the domain of f. Then
- F(X) * 10^N is the closest integer to f(X) * 10^N
- Ties are rounded away from zero.
In consequence, |F(X) - f(X)| <= 0.5*10^(-N).
The global accuracy N can be set with
Fn.SetAccuracy(N);
and be queried with
Fn.GetAccuracy();
For each implementation F(X) an alternative form FN(X, MyN) is provided, where the accuracy MyN can be directly set, as is illustrated by the following example.
Fn.SetAccuracy(10);
Fn.GetAccuracy();
Dec(Fn.Sqrt(2), 50);
Dec(Fn.SqrtN(2, 20), 50);
10
-------------------------------
1.4142135624
-------------------------------
1.4142135623730950488
When the domain of the functions allows it, the size of the input is not limited:
Dec(Fn.SinN(10^1000+42, 30), 30);
0.432516056256186928459429260133
Because of the current fixed point approach, the performance of the computation suffers in situations, where high accuracy might not not be wanted:
Time Dec(Fn.ExpN(2300, 30), 30);
75389068[...]278.856265938734206057642793183088
Cpu time = 8.04, User time = 8
Pages in category "ApCoCoA-1:Package elemfns"
The following 36 pages are in this category, out of 36 total.
F
- ApCoCoA-1:Fn.ArcCos
- ApCoCoA-1:Fn.ArcCosN
- ApCoCoA-1:Fn.ArcSin
- ApCoCoA-1:Fn.ArcSinN
- ApCoCoA-1:Fn.ArcTan
- ApCoCoA-1:Fn.ArcTanN
- ApCoCoA-1:Fn.Cos
- ApCoCoA-1:Fn.CosN
- ApCoCoA-1:Fn.E
- ApCoCoA-1:Fn.EN
- ApCoCoA-1:Fn.Exp
- ApCoCoA-1:Fn.ExpN
- ApCoCoA-1:Fn.GetAccuracy
- ApCoCoA-1:Fn.Ln
- ApCoCoA-1:Fn.Ln2
- ApCoCoA-1:Fn.Ln2N
- ApCoCoA-1:Fn.LnN
- ApCoCoA-1:Fn.Log
- ApCoCoA-1:Fn.LogN
- ApCoCoA-1:Fn.Pi
- ApCoCoA-1:Fn.PiN
- ApCoCoA-1:Fn.Pow
- ApCoCoA-1:Fn.PowN
- ApCoCoA-1:Fn.ReduceModLn2
- ApCoCoA-1:Fn.ReduceModPi
- ApCoCoA-1:Fn.Root
- ApCoCoA-1:Fn.RootN
- ApCoCoA-1:Fn.Round
- ApCoCoA-1:Fn.RoundN
- ApCoCoA-1:Fn.SetAccuracy
- ApCoCoA-1:Fn.Sin
- ApCoCoA-1:Fn.SinN
- ApCoCoA-1:Fn.Sqrt
- ApCoCoA-1:Fn.SqrtN
- ApCoCoA-1:Fn.Tan
- ApCoCoA-1:Fn.TanN