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