1 /*
2  * Author  : David Defour, Catherine Daramy, Florent de Dinechin, Christoph Lauter
3  * Contact : David.Defour@ens-lyon.fr, catherine_daramy@ens-lyon.fr
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 #ifndef CRLIBM_H
21 #define CRLIBM_H
22 
23 #if defined (__cplusplus)
24 extern "C" {
25 #endif
26 
27 
28 /* An init function which sets FPU flags when needed (mostly on Intel
29    architectures with default double extended) */
30 extern unsigned long long crlibm_init(void);
31 
32 /* An exit function which restores FPU flags when needed (mostly on Intel
33    architectures with default double extended) */
34 extern  void crlibm_exit(unsigned long long);
35 
36 
37 /* Finished functions */
38 /* These functions are computed in two steps and have an average
39    execution time comparable to that of a standard libm
40 */
41 
42 /*  exponential  */
43 extern double exp_rn(double); /* to nearest  */
44 extern double exp_rd(double); /* toward -inf */
45 extern double exp_ru(double); /* toward +inf */
46 #define exp_rz exp_rd         /* toward zero */
47 
48 /*  logarithm  */
49 extern double log_rn(double); /* to nearest  */
50 extern double log_rd(double); /* toward -inf */
51 extern double log_ru(double); /* toward +inf */
52 extern double log_rz(double); /* toward zero */
53 
54 /*  cosine  */
55 extern double cos_rn(double); /* to nearest  */
56 extern double cos_rd(double); /* toward -inf */
57 extern double cos_ru(double); /* toward +inf */
58 extern double cos_rz(double); /* toward zero */
59 
60 /*  sine  */
61 extern double sin_rn(double); /* to nearest  */
62 extern double sin_rd(double); /* toward -inf */
63 extern double sin_ru(double); /* toward +inf */
64 extern double sin_rz(double); /* toward zero */
65 
66 /*  tangent  */
67 extern double tan_rn(double); /* to nearest  */
68 extern double tan_rd(double); /* toward -inf */
69 extern double tan_ru(double); /* toward +inf */
70 extern double tan_rz(double); /* toward zero */
71 
72 /*  cosine of pi times x  */
73 extern double cospi_rn(double); /* to nearest  */
74 extern double cospi_rd(double); /* toward -inf */
75 extern double cospi_ru(double); /* toward +inf */
76 extern double cospi_rz(double); /* toward zero */
77 
78 /*  sine  of pi times x */
79 extern double sinpi_rn(double); /* to nearest  */
80 extern double sinpi_rd(double); /* toward -inf */
81 extern double sinpi_ru(double); /* toward +inf */
82 extern double sinpi_rz(double); /* toward zero */
83 
84 /*  tangent of pi times x */
85 extern double tanpi_rn(double); /* to nearest  */
86 extern double tanpi_rd(double); /* toward -inf */
87 extern double tanpi_ru(double); /* toward +inf */
88 extern double tanpi_rz(double); /* toward zero */
89 
90 
91 
92 
93 /* /\*  cotangent  *\/ */
94 /* extern double cotan_rn(double); /\* to nearest  *\/ */
95 /* extern double cotan_rd(double); /\* toward -inf *\/  */
96 /* extern double cotan_ru(double); /\* toward +inf *\/  */
97 /* extern double cotan_rz(double); /\* toward zero *\/  */
98 
99 /*  arctangent  */
100 extern double atan_rn(double); /* to nearest  */
101 extern double atan_rd(double); /* toward -inf */
102 extern double atan_ru(double); /* toward +inf */
103 extern double atan_rz(double); /* toward zero */
104 
105 /*  arctangentPi  */
106 extern double atanpi_rn(double); /* to nearest  */
107 extern double atanpi_rd(double); /* toward -inf */
108 extern double atanpi_ru(double); /* toward +inf */
109 extern double atanpi_rz(double); /* toward zero */
110 
111 /*  hyperbolic cosine*/
112 extern double cosh_rn(double); /* to nearest */
113 extern double cosh_rd(double); /* toward -inf */
114 extern double cosh_ru(double); /* toward +inf */
115 extern double cosh_rz(double); /* toward zero */
116 
117 /*  hyperbolic sine */
118 extern double sinh_rn(double); /* to nearest */
119 extern double sinh_rd(double); /* toward -inf */
120 extern double sinh_ru(double); /* toward +inf */
121 extern double sinh_rz(double); /* toward zero */
122 
123 
124 /* base 2 logarithm */
125 extern double log2_rn(double); /* to nearest  */
126 extern double log2_rd(double); /* toward -inf */
127 extern double log2_ru(double); /* toward +inf */
128 extern double log2_rz(double); /* towards zero */
129 
130 /* base 10 logarithm */
131 extern double log10_rn(double); /* to nearest  */
132 extern double log10_rd(double); /* toward -inf */
133 extern double log10_ru(double); /* toward +inf */
134 extern double log10_rz(double); /* towards zero */
135 
136 /* arcsine */
137 extern double asin_rn(double); /* to nearest */
138 extern double asin_rd(double); /* toward -inf */
139 extern double asin_ru(double); /* toward +inf */
140 extern double asin_rz(double); /* toward zero */
141 
142 /* arccosine */
143 extern double acos_rn(double); /* to nearest */
144 extern double acos_rd(double); /* toward -inf */
145 extern double acos_ru(double); /* toward +inf */
146 #define acos_rz acos_rd        /* toward zero */
147 
148 /* arcsine/PI */
149 extern double asinpi_rn(double); /* to nearest */
150 extern double asinpi_rd(double); /* toward -inf */
151 extern double asinpi_ru(double); /* toward +inf */
152 extern double asinpi_rz(double); /* toward zero */
153 
154 /* arccosine/PI */
155 extern double acospi_rn(double); /* to nearest */
156 extern double acospi_rd(double); /* toward -inf */
157 extern double acospi_ru(double); /* toward +inf */
158 #define acospi_rz acospi_rd      /* toward zero */
159 
160 /* expm1 = e^x -1 */
161 extern double expm1_rn(double); /* to nearest */
162 extern double expm1_rd(double); /* toward -inf */
163 extern double expm1_ru(double); /* toward +inf */
164 extern double expm1_rz(double); /* toward zero */
165 
166 /* log1p = log(1 + x) */
167 extern double log1p_rn(double); /* to nearest */
168 extern double log1p_rd(double); /* toward -inf */
169 extern double log1p_ru(double); /* toward +inf */
170 extern double log1p_rz(double); /* toward zero */
171 
172 
173 /* Unfinished functions */
174 /* These functions provide correct rounding but are very slow
175    (typically 100 times slower that the standard libm) */
176 
177 extern double exp2_rn(double); /* to nearest  */
178 extern double exp2_rd(double); /* toward -inf */
179 extern double exp2_ru(double); /* toward +inf */
180 
181 /*  pow */
182 /* ATTENTION: THIS FUNCTION IS UNDER DEVELOPMENT
183    AND CURRENTLY NOT PROVEN CORRECTLY ROUNDED FOR ALL CASES
184 
185    See the documentation
186 
187 */
188 extern double pow_rn(double, double);
189 
190 
191 /* fi_lib-compatible interval functions (EXPERIMENTAL) */
192 
193 #ifdef BUILD_INTERVAL_FUNCTIONS
194 #include "interval.h"
195 interval j_log(interval x);
196 interval j_exp(interval x);
197 #endif /* BUILD_INTERVAL_FUNCTIONS */
198 
199 #if defined (__cplusplus)
200 
201 }
202 #endif
203 
204 #endif /* ifdef CRLIBM_H*/
205