# Difference between revisions of "Category:Package elemfns"

S schuster (talk | contribs) (New page: 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 co...) |
S schuster (talk | contribs) |
||

Line 1: | Line 1: | ||

+ | Please note that this package is in beta status. This means, that function names are still 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 16:00, 4 May 2011

Please note that this package is in beta status. This means, that function names are still 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 "Package elemfns"

The following 36 pages are in this category, out of 36 total.

### F

- ApCoCoA:Fn.ArcCos
- ApCoCoA:Fn.ArcCosN
- ApCoCoA:Fn.ArcSin
- ApCoCoA:Fn.ArcSinN
- ApCoCoA:Fn.ArcTan
- ApCoCoA:Fn.ArcTanN
- ApCoCoA:Fn.Cos
- ApCoCoA:Fn.CosN
- ApCoCoA:Fn.E
- ApCoCoA:Fn.EN
- ApCoCoA:Fn.Exp
- ApCoCoA:Fn.ExpN
- ApCoCoA:Fn.GetAccuracy
- ApCoCoA:Fn.Ln
- ApCoCoA:Fn.Ln2
- ApCoCoA:Fn.Ln2N
- ApCoCoA:Fn.LnN
- ApCoCoA:Fn.Log
- ApCoCoA:Fn.LogN
- ApCoCoA:Fn.Pi
- ApCoCoA:Fn.PiN
- ApCoCoA:Fn.Pow
- ApCoCoA:Fn.PowN
- ApCoCoA:Fn.ReduceModLn2
- ApCoCoA:Fn.ReduceModPi
- ApCoCoA:Fn.Root
- ApCoCoA:Fn.RootN
- ApCoCoA:Fn.Round
- ApCoCoA:Fn.RoundN
- ApCoCoA:Fn.SetAccuracy
- ApCoCoA:Fn.Sin
- ApCoCoA:Fn.SinN
- ApCoCoA:Fn.Sqrt
- ApCoCoA:Fn.SqrtN
- ApCoCoA:Fn.Tan
- ApCoCoA:Fn.TanN