Copy-edit NEWS and fixup ChangeLog entries.
[glibc.git] / math / bits / math-finite.h
blob6888462e2f2765321e1aa2ddc428753d4cf925db
1 /* Entry points to finite-math-only compiler runs.
2 Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _MATH_H
20 # error "Never use <bits/math-finite.h> directly; include <math.h> instead."
21 #endif
23 /* acos. */
24 extern double __REDIRECT_NTH (acos, (double), __acos_finite);
25 extern float __REDIRECT_NTH (acosf, (float), __acosf_finite);
26 #ifdef __MATH_DECLARE_LDOUBLE
27 # ifdef __NO_LONG_DOUBLE_MATH
28 extern long double __REDIRECT_NTH (acosl, (long double), __acos_finite);
29 # else
30 extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite);
31 # endif
32 #endif
34 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
35 /* acosh. */
36 extern double __REDIRECT_NTH (acosh, (double), __acosh_finite);
37 extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite);
38 # ifdef __MATH_DECLARE_LDOUBLE
39 # ifdef __NO_LONG_DOUBLE_MATH
40 extern long double __REDIRECT_NTH (acoshl, (long double), __acosh_finite);
41 # else
42 extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite);
43 # endif
44 # endif
45 #endif
47 /* asin. */
48 extern double __REDIRECT_NTH (asin, (double), __asin_finite);
49 extern float __REDIRECT_NTH (asinf, (float), __asinf_finite);
50 #ifdef __MATH_DECLARE_LDOUBLE
51 # ifdef __NO_LONG_DOUBLE_MATH
52 extern long double __REDIRECT_NTH (asinl, (long double), __asin_finite);
53 # else
54 extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite);
55 # endif
56 #endif
58 /* atan2. */
59 extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite);
60 extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite);
61 #ifdef __MATH_DECLARE_LDOUBLE
62 # ifdef __NO_LONG_DOUBLE_MATH
63 extern long double __REDIRECT_NTH (atan2l, (long double, long double),
64 __atan2_finite);
65 # else
66 extern long double __REDIRECT_NTH (atan2l, (long double, long double),
67 __atan2l_finite);
68 # endif
69 #endif
71 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
72 /* atanh. */
73 extern double __REDIRECT_NTH (atanh, (double), __atanh_finite);
74 extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite);
75 # ifdef __MATH_DECLARE_LDOUBLE
76 # ifdef __NO_LONG_DOUBLE_MATH
77 extern long double __REDIRECT_NTH (atanhl, (long double), __atanh_finite);
78 # else
79 extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite);
80 # endif
81 # endif
82 #endif
84 /* cosh. */
85 extern double __REDIRECT_NTH (cosh, (double), __cosh_finite);
86 extern float __REDIRECT_NTH (coshf, (float), __coshf_finite);
87 #ifdef __MATH_DECLARE_LDOUBLE
88 # ifdef __NO_LONG_DOUBLE_MATH
89 extern long double __REDIRECT_NTH (coshl, (long double), __cosh_finite);
90 # else
91 extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite);
92 # endif
93 #endif
95 /* exp. */
96 extern double __REDIRECT_NTH (exp, (double), __exp_finite);
97 extern float __REDIRECT_NTH (expf, (float), __expf_finite);
98 #ifdef __MATH_DECLARE_LDOUBLE
99 # ifdef __NO_LONG_DOUBLE_MATH
100 extern long double __REDIRECT_NTH (expl, (long double), __exp_finite);
101 # else
102 extern long double __REDIRECT_NTH (expl, (long double), __expl_finite);
103 # endif
104 #endif
106 #ifdef __USE_GNU
107 /* exp10. */
108 extern double __REDIRECT_NTH (exp10, (double), __exp10_finite);
109 extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite);
110 # ifdef __MATH_DECLARE_LDOUBLE
111 # ifdef __NO_LONG_DOUBLE_MATH
112 extern long double __REDIRECT_NTH (exp10l, (long double), __exp10_finite);
113 # else
114 extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite);
115 # endif
116 # endif
118 /* pow10. */
119 extern double __REDIRECT_NTH (pow10, (double), __exp10_finite);
120 extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite);
121 # ifdef __MATH_DECLARE_LDOUBLE
122 # ifdef __NO_LONG_DOUBLE_MATH
123 extern long double __REDIRECT_NTH (pow10l, (long double), __exp10_finite);
124 # else
125 extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite);
126 # endif
127 # endif
128 #endif
130 #ifdef __USE_ISOC99
131 /* exp2. */
132 extern double __REDIRECT_NTH (exp2, (double), __exp2_finite);
133 extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite);
134 # ifdef __MATH_DECLARE_LDOUBLE
135 # ifdef __NO_LONG_DOUBLE_MATH
136 extern long double __REDIRECT_NTH (exp2l, (long double), __exp2_finite);
137 # else
138 extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite);
139 # endif
140 # endif
141 #endif
143 /* fmod. */
144 extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite);
145 extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite);
146 #ifdef __MATH_DECLARE_LDOUBLE
147 # ifdef __NO_LONG_DOUBLE_MATH
148 extern long double __REDIRECT_NTH (fmodl, (long double, long double),
149 __fmod_finite);
150 # else
151 extern long double __REDIRECT_NTH (fmodl, (long double, long double),
152 __fmodl_finite);
153 # endif
154 #endif
156 #ifdef __USE_ISOC99
157 /* hypot. */
158 extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite);
159 extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite);
160 # ifdef __MATH_DECLARE_LDOUBLE
161 # ifdef __NO_LONG_DOUBLE_MATH
162 extern long double __REDIRECT_NTH (hypotl, (long double, long double),
163 __hypot_finite);
164 # else
165 extern long double __REDIRECT_NTH (hypotl, (long double, long double),
166 __hypotl_finite);
167 # endif
168 # endif
169 #endif
171 #if defined __USE_MISC || defined __USE_XOPEN
172 /* j0. */
173 extern double __REDIRECT_NTH (j0, (double), __j0_finite);
174 extern float __REDIRECT_NTH (j0f, (float), __j0f_finite);
175 # ifdef __MATH_DECLARE_LDOUBLE
176 # ifdef __NO_LONG_DOUBLE_MATH
177 extern long double __REDIRECT_NTH (j0l, (long double), __j0_finite);
178 # else
179 extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite);
180 # endif
181 # endif
183 /* y0. */
184 extern double __REDIRECT_NTH (y0, (double), __y0_finite);
185 extern float __REDIRECT_NTH (y0f, (float), __y0f_finite);
186 # ifdef __MATH_DECLARE_LDOUBLE
187 # ifdef __NO_LONG_DOUBLE_MATH
188 extern long double __REDIRECT_NTH (y0l, (long double), __y0_finite);
189 # else
190 extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite);
191 # endif
192 # endif
194 /* j1. */
195 extern double __REDIRECT_NTH (j1, (double), __j1_finite);
196 extern float __REDIRECT_NTH (j1f, (float), __j1f_finite);
197 # ifdef __MATH_DECLARE_LDOUBLE
198 # ifdef __NO_LONG_DOUBLE_MATH
199 extern long double __REDIRECT_NTH (j1l, (long double), __j1_finite);
200 # else
201 extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite);
202 # endif
203 # endif
205 /* y1. */
206 extern double __REDIRECT_NTH (y1, (double), __y1_finite);
207 extern float __REDIRECT_NTH (y1f, (float), __y1f_finite);
208 # ifdef __MATH_DECLARE_LDOUBLE
209 # ifdef __NO_LONG_DOUBLE_MATH
210 extern long double __REDIRECT_NTH (y1l, (long double), __y1_finite);
211 # else
212 extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite);
213 # endif
214 # endif
216 /* jn. */
217 extern double __REDIRECT_NTH (jn, (int, double), __jn_finite);
218 extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite);
219 # ifdef __MATH_DECLARE_LDOUBLE
220 # ifdef __NO_LONG_DOUBLE_MATH
221 extern long double __REDIRECT_NTH (jnl, (int, long double), __jn_finite);
222 # else
223 extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite);
224 # endif
225 # endif
227 /* yn. */
228 extern double __REDIRECT_NTH (yn, (int, double), __yn_finite);
229 extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite);
230 # ifdef __MATH_DECLARE_LDOUBLE
231 # ifdef __NO_LONG_DOUBLE_MATH
232 extern long double __REDIRECT_NTH (ynl, (int, long double), __yn_finite);
233 # else
234 extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite);
235 # endif
236 # endif
237 #endif
239 #ifdef __USE_MISC
240 /* lgamma_r. */
241 extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite);
242 extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite);
243 # ifdef __MATH_DECLARE_LDOUBLE
244 # ifdef __NO_LONG_DOUBLE_MATH
245 extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
246 __lgamma_r_finite);
247 # else
248 extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
249 __lgammal_r_finite);
250 # endif
251 # endif
252 #endif
254 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
255 /* lgamma. */
256 __extern_always_inline double __NTH (lgamma (double __d))
258 # ifdef __USE_ISOC99
259 int __local_signgam = 0;
260 return lgamma_r (__d, &__local_signgam);
261 # else
262 return lgamma_r (__d, &signgam);
263 # endif
265 __extern_always_inline float __NTH (lgammaf (float __d))
267 # ifdef __USE_ISOC99
268 int __local_signgam = 0;
269 return lgammaf_r (__d, &__local_signgam);
270 # else
271 return lgammaf_r (__d, &signgam);
272 # endif
274 # ifdef __MATH_DECLARE_LDOUBLE
275 __extern_always_inline long double __NTH (lgammal (long double __d))
277 # ifdef __USE_ISOC99
278 int __local_signgam = 0;
279 return lgammal_r (__d, &__local_signgam);
280 # else
281 return lgammal_r (__d, &signgam);
282 # endif
284 # endif
285 #endif
287 #if defined __USE_MISC || defined __USE_XOPEN
288 /* gamma. */
289 __extern_always_inline double __NTH (gamma (double __d))
291 # ifdef __USE_ISOC99
292 int __local_signgam = 0;
293 return lgamma_r (__d, &__local_signgam);
294 # else
295 return lgamma_r (__d, &signgam);
296 # endif
298 __extern_always_inline float __NTH (gammaf (float __d))
300 # ifdef __USE_ISOC99
301 int __local_signgam = 0;
302 return lgammaf_r (__d, &__local_signgam);
303 # else
304 return lgammaf_r (__d, &signgam);
305 # endif
307 # ifdef __MATH_DECLARE_LDOUBLE
308 __extern_always_inline long double __NTH (gammal (long double __d))
310 # ifdef __USE_ISOC99
311 int __local_signgam = 0;
312 return lgammal_r (__d, &__local_signgam);
313 # else
314 return lgammal_r (__d, &signgam);
315 # endif
317 # endif
318 #endif
320 /* log. */
321 extern double __REDIRECT_NTH (log, (double), __log_finite);
322 extern float __REDIRECT_NTH (logf, (float), __logf_finite);
323 #ifdef __MATH_DECLARE_LDOUBLE
324 # ifdef __NO_LONG_DOUBLE_MATH
325 extern long double __REDIRECT_NTH (logl, (long double), __log_finite);
326 # else
327 extern long double __REDIRECT_NTH (logl, (long double), __logl_finite);
328 # endif
329 #endif
331 /* log10. */
332 extern double __REDIRECT_NTH (log10, (double), __log10_finite);
333 extern float __REDIRECT_NTH (log10f, (float), __log10f_finite);
334 #ifdef __MATH_DECLARE_LDOUBLE
335 # ifdef __NO_LONG_DOUBLE_MATH
336 extern long double __REDIRECT_NTH (log10l, (long double), __log10_finite);
337 # else
338 extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite);
339 # endif
340 #endif
342 #ifdef __USE_ISOC99
343 /* log2. */
344 extern double __REDIRECT_NTH (log2, (double), __log2_finite);
345 extern float __REDIRECT_NTH (log2f, (float), __log2f_finite);
346 # ifdef __MATH_DECLARE_LDOUBLE
347 # ifdef __NO_LONG_DOUBLE_MATH
348 extern long double __REDIRECT_NTH (log2l, (long double), __log2_finite);
349 # else
350 extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite);
351 # endif
352 # endif
353 #endif
355 /* ldexp. */
356 extern double __REDIRECT_NTH (ldexp, (double, int), scalbn);
357 extern float __REDIRECT_NTH (ldexpf, (float, int), scalbnf);
358 #ifdef __MATH_DECLARE_LDOUBLE
359 extern long double __REDIRECT_NTH (ldexpl, (long double, int), scalbnl);
360 #endif
362 /* pow. */
363 extern double __REDIRECT_NTH (pow, (double, double), __pow_finite);
364 extern float __REDIRECT_NTH (powf, (float, float), __powf_finite);
365 #ifdef __MATH_DECLARE_LDOUBLE
366 # ifdef __NO_LONG_DOUBLE_MATH
367 extern long double __REDIRECT_NTH (powl, (long double, long double),
368 __pow_finite);
369 # else
370 extern long double __REDIRECT_NTH (powl, (long double, long double),
371 __powl_finite);
372 # endif
373 #endif
375 /* remainder. */
376 extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite);
377 extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite);
378 #ifdef __MATH_DECLARE_LDOUBLE
379 # ifdef __NO_LONG_DOUBLE_MATH
380 extern long double __REDIRECT_NTH (remainderl, (long double, long double),
381 __remainder_finite);
382 # else
383 extern long double __REDIRECT_NTH (remainderl, (long double, long double),
384 __remainderl_finite);
385 # endif
386 #endif
388 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
389 /* scalb. */
390 extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite);
391 extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite);
392 # ifdef __MATH_DECLARE_LDOUBLE
393 # ifdef __NO_LONG_DOUBLE_MATH
394 extern long double __REDIRECT_NTH (scalbl, (long double, long double),
395 __scalb_finite);
396 # else
397 extern long double __REDIRECT_NTH (scalbl, (long double, long double),
398 __scalbl_finite);
399 # endif
400 # endif
401 #endif
403 /* sinh. */
404 extern double __REDIRECT_NTH (sinh, (double), __sinh_finite);
405 extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite);
406 #ifdef __MATH_DECLARE_LDOUBLE
407 # ifdef __NO_LONG_DOUBLE_MATH
408 extern long double __REDIRECT_NTH (sinhl, (long double), __sinh_finite);
409 # else
410 extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite);
411 # endif
412 #endif
414 /* sqrt. */
415 extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite);
416 extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite);
417 #ifdef __MATH_DECLARE_LDOUBLE
418 # ifdef __NO_LONG_DOUBLE_MATH
419 extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrt_finite);
420 # else
421 extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite);
422 # endif
423 #endif
425 #ifdef __USE_ISOC99
426 /* tgamma. */
427 extern double __gamma_r_finite (double, int *);
428 __extern_always_inline double __NTH (tgamma (double __d))
430 int __local_signgam = 0;
431 double __res = __gamma_r_finite (__d, &__local_signgam);
432 return __local_signgam < 0 ? -__res : __res;
434 extern float __gammaf_r_finite (float, int *);
435 __extern_always_inline float __NTH (tgammaf (float __d))
437 int __local_signgam = 0;
438 float __res = __gammaf_r_finite (__d, &__local_signgam);
439 return __local_signgam < 0 ? -__res : __res;
441 # ifdef __MATH_DECLARE_LDOUBLE
442 extern long double __gammal_r_finite (long double, int *);
443 __extern_always_inline long double __NTH (tgammal (long double __d))
445 int __local_signgam = 0;
446 # ifdef __NO_LONG_DOUBLE_MATH
447 long double __res = __gamma_r_finite (__d, &__local_signgam);
448 # else
449 long double __res = __gammal_r_finite (__d, &__local_signgam);
450 # endif
451 return __local_signgam < 0 ? -__res : __res;
453 # endif
454 #endif