]> www.ginac.de Git - cln.git/blob - src/float/transcendental/cl_F_tran.h
* All Files have been modified for inclusion of namespace cln;
[cln.git] / src / float / transcendental / cl_F_tran.h
1 // Internals for transcendental functions on floating-point numbers
2
3 #ifndef _CL_F_TRAN_H
4 #define _CL_F_TRAN_H
5
6 #include "cln/number.h"
7 #include "cln/float.h"
8
9 namespace cln {
10
11 // pi.
12 extern const cl_SF cl_SF_pi;
13 extern const cl_FF cl_FF_pi;
14 extern const cl_DF cl_DF_pi;
15 extern cl_LF cl_LF_pi; // as long as it has ever been computed
16 extern const cl_LF pi (uintC len); // computes it even further
17 //CL_REQUIRE(cl_F_pi_var)
18
19 // cl_exp_aux(p,lq,len) liefert die Zahl exp(p/2^lq) mit len Digits.
20 // 0 < |p| < 2^lq.
21 // Es sollte |p|^2 < 2^lq sein, sonst ist das nicht effizient.
22 extern const cl_LF cl_exp_aux (const cl_I& p, uintL lq, uintC len);
23
24 // cl_cossin_aux(p,lq,len) liefert cos(p/2^lq) und sin(p/2^lq) mit len Digits.
25 // 0 < |p| < 2^lq.
26 // Es sollte |p|^2 < 2^lq sein, sonst ist das nicht effizient.
27 struct cl_LF_cos_sin_t {
28         cl_LF cos;
29         cl_LF sin;
30 // Constructor:
31         cl_LF_cos_sin_t (const cl_LF& u, const cl_LF& v) : cos (u), sin (v) {}
32         cl_LF_cos_sin_t () {}
33 };
34 extern const cl_LF_cos_sin_t cl_cossin_aux (const cl_I& p, uintL lq, uintC len);
35
36 // cl_coshsinh_aux(p,lq,len) liefert cosh(p/2^lq) und sinh(p/2^lq) mit len Digits.
37 // 0 < |p| < 2^lq.
38 // Es sollte |p|^2 < 2^lq sein, sonst ist das nicht effizient.
39 struct cl_LF_cosh_sinh_t {
40         cl_LF cosh;
41         cl_LF sinh;
42 // Constructor:
43         cl_LF_cosh_sinh_t (const cl_LF& u, const cl_LF& v) : cosh (u), sinh (v) {}
44         cl_LF_cosh_sinh_t () {}
45 };
46 extern const cl_LF_cosh_sinh_t cl_coshsinh_aux (const cl_I& p, uintL lq, uintC len);
47
48 // atanhx(x) liefert zu einem Float x (betragsmäßig <1/2) atanh(x) als Float.
49 extern const cl_F atanhx (const cl_F& x);
50
51 // atanx(x) liefert zu einem Float x (betragsmäßig <=1) atan(x) als Float.
52 extern const cl_F atanx (const cl_F& x);
53
54 // sinx(x) liefert zu einem Float x (betragsmäßig <1) sin(x)^2 als Float.
55 // sinxbyx(x) liefert zu einem Float x (betragsmäßig <1) (sin(x)/x)^2 als Float.
56 extern const cl_LF sinx_naive (const cl_LF& x); // requires cl_F_extendsqrt
57 extern const cl_F sinxbyx_naive (const cl_F& x); // requires cl_F_extendsqrt
58 // (cos(x),sin(x)) für ein Long-Float x (betragsmäßig <1).
59 extern const cl_LF_cos_sin_t cl_cossin_ratseries (const cl_LF& x); // requires extend by 1
60
61 // sinhx(x) liefert zu einem Float x (betragsmäßig <1) sinh(x)^2 als Float.
62 // sinhxbyx(x) liefert zu einem Float x (betragsmäßig <1) (sinh(x)/x)^2 als Float.
63 extern const cl_LF sinhx_naive (const cl_LF& x); // requires cl_F_extendsqrt
64 extern const cl_F sinhxbyx_naive (const cl_F& x); // requires cl_F_extendsqrt
65 // (cosh(x),sinh(x)) für ein Long-Float x (betragsmäßig <1).
66 extern const cl_LF_cosh_sinh_t cl_coshsinh_ratseries (const cl_LF& x); // requires extend by 1
67
68 // cl_round_pi(x) dividiert ein Float x mit Rest durch pi.
69 // Beide Werte von (round x (float pi x)).
70 extern const cl_F_div_t cl_round_pi (const cl_F& x);
71
72 // cl_round_pi2(x) dividiert ein Float x mit Rest durch pi/2.
73 // Beide Werte von (round x (float pi/2 x)).
74 extern const cl_F_div_t cl_round_pi2 (const cl_F& x);
75
76 // cl_atan_recip(m,len) liefert arctan(1/m) mit len Digits.
77 extern const cl_LF cl_atan_recip (cl_I m, uintC len);
78
79 // lnx(x) liefert zu einem Float x (>=1/2, <=2) ln(x) als Float.
80 extern const cl_F lnx_naive (const cl_F& x); // requires cl_F_extendsqrtx
81 extern const cl_LF lnx_naive (const cl_LF& x); // requires cl_F_extendsqrtx
82 extern const cl_LF lnx_ratseries (const cl_LF& x); // requires extend by 1
83
84 // cl_atanh_recip(m,len) liefert artanh(1/m) mit len Digits.
85 extern const cl_LF cl_atanh_recip (cl_I m, uintC len);
86
87 // ln(2).
88 extern const cl_SF cl_SF_ln2;
89 extern const cl_FF cl_FF_ln2;
90 extern const cl_DF cl_DF_ln2;
91 extern cl_LF cl_LF_ln2; // as long as it has ever been computed
92 extern const cl_LF cl_ln2 (uintC len); // computes it even further
93 //CL_REQUIRE(cl_F_ln2_var)
94
95 // cl_ln2(y) liefert die Zahl ln(2) im selben Float-Format wie y.
96 // > y: ein Float
97 extern const cl_F cl_ln2 (const cl_F& y);
98
99 // cl_ln2(y) liefert die Zahl ln(2) im Float-Format f.
100 // > f: eine Float-Format-Spezifikation
101 extern const cl_F cl_ln2 (float_format_t f);
102
103 // ln(10).
104 extern const cl_SF cl_SF_ln10;
105 extern const cl_FF cl_FF_ln10;
106 extern const cl_DF cl_DF_ln10;
107 extern cl_LF cl_LF_ln10; // as long as it has ever been computed
108 extern const cl_LF cl_ln10 (uintC len); // computes it even further
109 //CL_REQUIRE(cl_F_ln10_var)
110
111 // cl_ln10(y) liefert die Zahl ln(10) im selben Float-Format wie y.
112 // > y: ein Float
113 extern const cl_F cl_ln10 (const cl_F& y);
114
115 // cl_ln10(y) liefert die Zahl ln(10) im Float-Format f.
116 // > f: eine Float-Format-Spezifikation
117 extern const cl_F cl_ln10 (float_format_t f);
118
119 // e = exp(1).
120 extern const cl_SF cl_SF_exp1;
121 extern const cl_FF cl_FF_exp1;
122 extern const cl_DF cl_DF_exp1;
123 extern cl_LF cl_LF_exp1; // as long as it has ever been computed
124 extern const cl_LF exp1 (uintC len); // computes it even further
125
126 // expx(x) liefert zu einem Float x (betragsmäßig <1) exp(x) als Float.
127 extern const cl_F expx_naive (const cl_F& x); // requires cl_F_extendsqrtx
128 extern const cl_LF expx_naive (const cl_LF& x); // requires cl_F_extendsqrtx
129 extern const cl_LF expx_ratseries (const cl_LF& x); // requires extend by 1
130
131 // Eulersche Konstante.
132 extern const cl_SF cl_SF_eulerconst;
133 extern const cl_FF cl_FF_eulerconst;
134 extern const cl_DF cl_DF_eulerconst;
135 extern cl_LF cl_LF_eulerconst; // as long as it has ever been computed
136 extern const cl_LF eulerconst (uintC len); // computes it even further
137
138 // Catalansche Konstante.
139 extern const cl_SF cl_SF_catalanconst;
140 extern const cl_FF cl_FF_catalanconst;
141 extern const cl_DF cl_DF_catalanconst;
142 extern cl_LF cl_LF_catalanconst; // as long as it has ever been computed
143 extern const cl_LF catalanconst (uintC len); // computes it even further
144
145 // Zeta-Funktion für s>1 ganzzahlig.
146 extern const cl_LF zeta (int s, uintC len);
147 // Zeta-Funktion für s=3.
148 extern const cl_LF zeta3 (uintC len);
149
150 }  // namespace cln
151
152 #endif /* _CL_F_TRAN_H */