Optimize exp
[platform/upstream/glibc.git] / math / bits / math-finite.h
1 /* Entry points to finite-math-only compiler runs.
2    Copyright (C) 2011 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    The GNU C Library 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 GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #ifndef _MATH_H
21 # error "Never use <bits/math-finite.h> directly; include <math.h> instead."
22 #endif
23
24 /* acos.  */
25 extern double acos (double) __asm__ ("__acos_finite");
26 extern float acosf (float) __asm__ ("__acosf_finite");
27 #ifdef __MATH_DECLARE_LDOUBLE
28 extern long double acosl (long double) __asm__ ("__acosl_finite");
29 #endif
30
31 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
32 /* acosh.  */
33 extern double acosh (double) __asm__ ("__acosh_finite");
34 extern float acoshf (float) __asm__ ("__acoshf_finite");
35 # ifdef __MATH_DECLARE_LDOUBLE
36 extern long double acoshl (long double) __asm__ ("__acoshl_finite");
37 # endif
38 #endif
39
40 /* asin.  */
41 extern double asin (double) __asm__ ("__asin_finite");
42 extern float asinf (float) __asm__ ("__asinf_finite");
43 #ifdef __MATH_DECLARE_LDOUBLE
44 extern long double asinl (long double) __asm__ ("__asinl_finite");
45 #endif
46
47 /* atan2.  */
48 extern double atan2 (double, double) __asm__ ("__atan2_finite");
49 extern float atan2f (float, float) __asm__ ("__atan2f_finite");
50 #ifdef __MATH_DECLARE_LDOUBLE
51 extern long double atan2l (long double, long double) __asm__ ("__atan2l_finite");
52 #endif
53
54 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
55 /* atanh.  */
56 extern double atanh (double) __asm__ ("__atanh_finite");
57 extern float atanhf (float) __asm__ ("__atanhf_finite");
58 # ifdef __MATH_DECLARE_LDOUBLE
59 extern long double atanhl (long double) __asm__ ("__atanhl_finite");
60 # endif
61 #endif
62
63 /* cosh.  */
64 extern double cosh (double) __asm__ ("__cosh_finite");
65 extern float coshf (float) __asm__ ("__coshf_finite");
66 #ifdef __MATH_DECLARE_LDOUBLE
67 extern long double coshl (long double) __asm__ ("__coshl_finite");
68 #endif
69
70 /* exp.  */
71 extern double exp (double) __asm__ ("__exp_finite");
72 extern float expf (float) __asm__ ("__expf_finite");
73 #ifdef __MATH_DECLARE_LDOUBLE
74 extern long double expl (long double) __asm__ ("__expl_finite");
75 #endif
76
77 #ifdef __USE_GNU
78 /* exp10.  */
79 extern double exp10 (double) __asm__ ("__exp10_finite");
80 extern float exp10f (float) __asm__ ("__exp10f_finite");
81 # ifdef __MATH_DECLARE_LDOUBLE
82 extern long double exp10l (long double) __asm__ ("__exp10l_finite");
83 # endif
84
85 /* pow10.  */
86 extern double pow10 (double) __asm__ ("__exp10_finite");
87 extern float pow10f (float) __asm__ ("__exp10f_finite");
88 # ifdef __MATH_DECLARE_LDOUBLE
89 extern long double pow10l (long double) __asm__ ("__exp10l_finite");
90 # endif
91 #endif
92
93 #ifdef __USE_ISOC99
94 /* exp2.  */
95 extern double exp2 (double) __asm__ ("__exp2_finite");
96 extern float exp2f (float) __asm__ ("__exp2f_finite");
97 # ifdef __MATH_DECLARE_LDOUBLE
98 extern long double exp2l (long double) __asm__ ("__exp2l_finite");
99 # endif
100 #endif
101
102 /* fmod.  */
103 extern double fmod (double, double) __asm__ ("__fmod_finite");
104 extern float fmodf (float, float) __asm__ ("__fmodf_finite");
105 #ifdef __MATH_DECLARE_LDOUBLE
106 extern long double fmodl (long double, long double) __asm__ ("__fmodl_finite");
107 #endif
108
109 #ifdef __USE_ISOC99
110 /* hypot.  */
111 extern double hypot (double, double) __asm__ ("__hypot_finite");
112 extern float hypotf (float, float) __asm__ ("__hypotf_finite");
113 # ifdef __MATH_DECLARE_LDOUBLE
114 extern long double hypotl (long double, long double) __asm__ ("__hypotl_finite");
115 # endif
116 #endif
117
118 #if defined __USE_MISC || defined __USE_XOPEN
119 /* j0.  */
120 extern double j0 (double) __asm__ ("__j0_finite");
121 extern float j0f (float) __asm__ ("__j0f_finite");
122 # ifdef __MATH_DECLARE_LDOUBLE
123 extern long double j0l (long double) __asm__ ("__j0l_finite");
124 # endif
125
126 /* y0.  */
127 extern double y0 (double) __asm__ ("__y0_finite");
128 extern float y0f (float) __asm__ ("__y0f_finite");
129 # ifdef __MATH_DECLARE_LDOUBLE
130 extern long double y0l (long double) __asm__ ("__y0l_finite");
131 # endif
132
133 /* j1.  */
134 extern double j1 (double) __asm__ ("__j1_finite");
135 extern float j1f (float) __asm__ ("__j1f_finite");
136 # ifdef __MATH_DECLARE_LDOUBLE
137 extern long double j1l (long double) __asm__ ("__j1l_finite");
138 # endif
139
140 /* y1.  */
141 extern double y1 (double) __asm__ ("__y1_finite");
142 extern float y1f (float) __asm__ ("__y1f_finite");
143 # ifdef __MATH_DECLARE_LDOUBLE
144 extern long double y1l (long double) __asm__ ("__y1l_finite");
145 # endif
146
147 /* jn.  */
148 extern double jn (int, double) __asm__ ("__jn_finite");
149 extern float jnf (int, float) __asm__ ("__jnf_finite");
150 # ifdef __MATH_DECLARE_LDOUBLE
151 extern long double jnl (int, long double) __asm__ ("__jnl_finite");
152 # endif
153
154 /* yn.  */
155 extern double yn (int, double) __asm__ ("__yn_finite");
156 extern float ynf (int, float) __asm__ ("__ynf_finite");
157 # ifdef __MATH_DECLARE_LDOUBLE
158 extern long double ynl (int, long double) __asm__ ("__ynl_finite");
159 # endif
160 #endif
161
162 #ifdef __USE_MISC
163 /* lgamma_r.  */
164 extern double lgamma_r (double, int *) __asm__ ("__lgamma_r_finite");
165 extern float lgammaf_r (float, int *) __asm__ ("__lgammaf_r_finite");
166 # ifdef __MATH_DECLARE_LDOUBLE
167 extern long double lgammal_r (long double, int *) __asm__ ("__lgammal_r_finite");
168 # endif
169 #endif
170
171 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
172 /* lgamma.  */
173 __extern_always_inline double lgamma (double __d)
174 {
175 # ifdef __USE_ISOC99
176   int __local_signgam = 0;
177   return lgamma_r (__d, &__local_signgam);
178 # else
179   return lgamma_r (__d, &signgam);
180 # endif
181 }
182 __extern_always_inline float lgammaf (float __d)
183 {
184 # ifdef __USE_ISOC99
185   int __local_signgam = 0;
186   return lgammaf_r (__d, &__local_signgam);
187 # else
188   return lgammaf_r (__d, &signgam);
189 # endif
190 }
191 # ifdef __MATH_DECLARE_LDOUBLE
192 __extern_always_inline long double lgammal (long double __d)
193 {
194 # ifdef __USE_ISOC99
195   int __local_signgam = 0;
196   return lgammal_r (__d, &__local_signgam);
197 # else
198   return lgammal_r (__d, &signgam);
199 # endif
200 }
201 # endif
202 #endif
203
204 #if defined __USE_MISC || defined __USE_XOPEN
205 /* gamma.  */
206 __extern_always_inline double gamma (double __d)
207 {
208 # ifdef __USE_ISOC99
209   int __local_signgam = 0;
210   return lgamma_r (__d, &__local_signgam);
211 # else
212   return lgamma_r (__d, &signgam);
213 # endif
214 }
215 __extern_always_inline float gammaf (float __d)
216 {
217 # ifdef __USE_ISOC99
218   int __local_signgam = 0;
219   return lgammaf_r (__d, &__local_signgam);
220 # else
221   return lgammaf_r (__d, &signgam);
222 # endif
223 }
224 # ifdef __MATH_DECLARE_LDOUBLE
225 __extern_always_inline long double gammal (long double __d)
226 {
227 #  ifdef __USE_ISOC99
228   int __local_signgam = 0;
229   return lgammal_r (__d, &__local_signgam);
230 #  else
231   return lgammal_r (__d, &signgam);
232 #  endif
233 }
234 # endif
235 #endif
236
237 /* log.  */
238 extern double log (double) __asm__ ("__log_finite");
239 extern float logf (float) __asm__ ("__logf_finite");
240 #ifdef __MATH_DECLARE_LDOUBLE
241 extern long double logl (long double) __asm__ ("__logl_finite");
242 #endif
243
244 /* log10.  */
245 extern double log10 (double) __asm__ ("__log10_finite");
246 extern float log10f (float) __asm__ ("__log10f_finite");
247 #ifdef __MATH_DECLARE_LDOUBLE
248 extern long double log10l (long double) __asm__ ("__log10l_finite");
249 #endif
250
251 #ifdef __USE_ISOC99
252 /* log2.  */
253 extern double log2 (double) __asm__ ("__log2_finite");
254 extern float log2f (float) __asm__ ("__log2f_finite");
255 # ifdef __MATH_DECLARE_LDOUBLE
256 extern long double log2l (long double) __asm__ ("__log2l_finite");
257 # endif
258 #endif
259
260 /* pow.  */
261 extern double pow (double, double) __asm__ ("__pow_finite");
262 extern float powf (float, float) __asm__ ("__powf_finite");
263 #ifdef __MATH_DECLARE_LDOUBLE
264 extern long double powl (long double, long double) __asm__ ("__powl_finite");
265 #endif
266
267 /* remainder.  */
268 extern double remainder (double, double) __asm__ ("__remainder_finite");
269 extern float remainderf (float, float) __asm__ ("__remainderf_finite");
270 #ifdef __MATH_DECLARE_LDOUBLE
271 extern long double remainderl (long double, long double) __asm__ ("__remainderl_finite");
272 #endif
273
274 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
275 /* scalb.  */
276 extern double scalb (double, double) __asm__ ("__scalb_finite");
277 extern float scalbf (float, float) __asm__ ("__scalbf_finite");
278 # ifdef __MATH_DECLARE_LDOUBLE
279 extern long double scalbl (long double, long double) __asm__ ("__scalbl_finite");
280 # endif
281 #endif
282
283 /* sinh.  */
284 extern double sinh (double) __asm__ ("__sinh_finite");
285 extern float sinhf (float) __asm__ ("__sinhf_finite");
286 #ifdef __MATH_DECLARE_LDOUBLE
287 extern long double sinhl (long double) __asm__ ("__sinhl_finite");
288 #endif
289
290 /* sqrt.  */
291 extern double sqrt (double) __asm__ ("__sqrt_finite");
292 extern float sqrtf (float) __asm__ ("__sqrtf_finite");
293 #ifdef __MATH_DECLARE_LDOUBLE
294 extern long double sqrtl (long double) __asm__ ("__sqrtl_finite");
295 #endif
296
297 #ifdef __USE_ISOC99
298 /* tgamma.  */
299 extern double __gamma_r_finite (double, int *);
300 __extern_always_inline double tgamma (double __d)
301 {
302   int __local_signgam = 0;
303   double __res = __gamma_r_finite (__d, &__local_signgam);
304   return __local_signgam < 0 ? -__res : __res;
305 }
306 extern float __gammaf_r_finite (float, int *);
307 __extern_always_inline float tgammaf (float __d)
308 {
309   int __local_signgam = 0;
310   float __res = __gammaf_r_finite (__d, &__local_signgam);
311   return __local_signgam < 0 ? -__res : __res;
312 }
313 # ifdef __MATH_DECLARE_LDOUBLE
314 extern long double __gammal_r_finite (long double, int *);
315 __extern_always_inline long double tgammal (long double __d)
316 {
317   int __local_signgam = 0;
318   long double __res = __gammal_r_finite (__d, &__local_signgam);
319   return __local_signgam < 0 ? -__res : __res;
320 }
321 # endif
322 #endif