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