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