blob: adaad0e4e4086de1bf58db6e10f99b2b25b84787 [file] [log] [blame]
xf.libdd93d52023-05-12 07:10:14 -07001/* Entry points to finite-math-only compiler runs.
2 Copyright (C) 2011-2016 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, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _MATH_H
20# error "Never use <bits/math-finite.h> directly; include <math.h> instead."
21#endif
22
23/* acos. */
24extern double __REDIRECT_NTH (acos, (double), __acos_finite);
25#ifdef __USE_ISOC99
26extern float __REDIRECT_NTH (acosf, (float), __acosf_finite);
27# ifdef __MATH_DECLARE_LDOUBLE
28# ifdef __NO_LONG_DOUBLE_MATH
29extern long double __REDIRECT_NTH (acosl, (long double), __acos_finite);
30# else
31extern long double __REDIRECT_NTH (acosl, (long double), __acosl_finite);
32# endif
33# endif
34#endif
35
36#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
37/* acosh. */
38extern double __REDIRECT_NTH (acosh, (double), __acosh_finite);
39#endif
40#ifdef __USE_ISOC99
41extern float __REDIRECT_NTH (acoshf, (float), __acoshf_finite);
42# ifdef __MATH_DECLARE_LDOUBLE
43# ifdef __NO_LONG_DOUBLE_MATH
44extern long double __REDIRECT_NTH (acoshl, (long double), __acosh_finite);
45# else
46extern long double __REDIRECT_NTH (acoshl, (long double), __acoshl_finite);
47# endif
48# endif
49#endif
50
51/* asin. */
52extern double __REDIRECT_NTH (asin, (double), __asin_finite);
53#ifdef __USE_ISOC99
54extern float __REDIRECT_NTH (asinf, (float), __asinf_finite);
55# ifdef __MATH_DECLARE_LDOUBLE
56# ifdef __NO_LONG_DOUBLE_MATH
57extern long double __REDIRECT_NTH (asinl, (long double), __asin_finite);
58# else
59extern long double __REDIRECT_NTH (asinl, (long double), __asinl_finite);
60# endif
61# endif
62#endif
63
64/* atan2. */
65extern double __REDIRECT_NTH (atan2, (double, double), __atan2_finite);
66#ifdef __USE_ISOC99
67extern float __REDIRECT_NTH (atan2f, (float, float), __atan2f_finite);
68# ifdef __MATH_DECLARE_LDOUBLE
69# ifdef __NO_LONG_DOUBLE_MATH
70extern long double __REDIRECT_NTH (atan2l, (long double, long double),
71 __atan2_finite);
72# else
73extern long double __REDIRECT_NTH (atan2l, (long double, long double),
74 __atan2l_finite);
75# endif
76# endif
77#endif
78
79#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
80/* atanh. */
81extern double __REDIRECT_NTH (atanh, (double), __atanh_finite);
82#endif
83#ifdef __USE_ISOC99
84extern float __REDIRECT_NTH (atanhf, (float), __atanhf_finite);
85# ifdef __MATH_DECLARE_LDOUBLE
86# ifdef __NO_LONG_DOUBLE_MATH
87extern long double __REDIRECT_NTH (atanhl, (long double), __atanh_finite);
88# else
89extern long double __REDIRECT_NTH (atanhl, (long double), __atanhl_finite);
90# endif
91# endif
92#endif
93
94/* cosh. */
95extern double __REDIRECT_NTH (cosh, (double), __cosh_finite);
96#ifdef __USE_ISOC99
97extern float __REDIRECT_NTH (coshf, (float), __coshf_finite);
98# ifdef __MATH_DECLARE_LDOUBLE
99# ifdef __NO_LONG_DOUBLE_MATH
100extern long double __REDIRECT_NTH (coshl, (long double), __cosh_finite);
101# else
102extern long double __REDIRECT_NTH (coshl, (long double), __coshl_finite);
103# endif
104# endif
105#endif
106
107/* exp. */
108extern double __REDIRECT_NTH (exp, (double), __exp_finite);
109#ifdef __USE_ISOC99
110extern float __REDIRECT_NTH (expf, (float), __expf_finite);
111# ifdef __MATH_DECLARE_LDOUBLE
112# ifdef __NO_LONG_DOUBLE_MATH
113extern long double __REDIRECT_NTH (expl, (long double), __exp_finite);
114# else
115extern long double __REDIRECT_NTH (expl, (long double), __expl_finite);
116# endif
117# endif
118#endif
119
120#ifdef __USE_GNU
121/* exp10. */
122extern double __REDIRECT_NTH (exp10, (double), __exp10_finite);
123extern float __REDIRECT_NTH (exp10f, (float), __exp10f_finite);
124# ifdef __MATH_DECLARE_LDOUBLE
125# ifdef __NO_LONG_DOUBLE_MATH
126extern long double __REDIRECT_NTH (exp10l, (long double), __exp10_finite);
127# else
128extern long double __REDIRECT_NTH (exp10l, (long double), __exp10l_finite);
129# endif
130# endif
131
132/* pow10. */
133extern double __REDIRECT_NTH (pow10, (double), __exp10_finite);
134extern float __REDIRECT_NTH (pow10f, (float), __exp10f_finite);
135# ifdef __MATH_DECLARE_LDOUBLE
136# ifdef __NO_LONG_DOUBLE_MATH
137extern long double __REDIRECT_NTH (pow10l, (long double), __exp10_finite);
138# else
139extern long double __REDIRECT_NTH (pow10l, (long double), __exp10l_finite);
140# endif
141# endif
142#endif
143
144#ifdef __USE_ISOC99
145/* exp2. */
146extern double __REDIRECT_NTH (exp2, (double), __exp2_finite);
147extern float __REDIRECT_NTH (exp2f, (float), __exp2f_finite);
148# ifdef __MATH_DECLARE_LDOUBLE
149# ifdef __NO_LONG_DOUBLE_MATH
150extern long double __REDIRECT_NTH (exp2l, (long double), __exp2_finite);
151# else
152extern long double __REDIRECT_NTH (exp2l, (long double), __exp2l_finite);
153# endif
154# endif
155#endif
156
157/* fmod. */
158extern double __REDIRECT_NTH (fmod, (double, double), __fmod_finite);
159#ifdef __USE_ISOC99
160extern float __REDIRECT_NTH (fmodf, (float, float), __fmodf_finite);
161# ifdef __MATH_DECLARE_LDOUBLE
162# ifdef __NO_LONG_DOUBLE_MATH
163extern long double __REDIRECT_NTH (fmodl, (long double, long double),
164 __fmod_finite);
165# else
166extern long double __REDIRECT_NTH (fmodl, (long double, long double),
167 __fmodl_finite);
168# endif
169# endif
170#endif
171
172#if defined __USE_XOPEN || defined __USE_ISOC99
173/* hypot. */
174extern double __REDIRECT_NTH (hypot, (double, double), __hypot_finite);
175#endif
176#ifdef __USE_ISOC99
177extern float __REDIRECT_NTH (hypotf, (float, float), __hypotf_finite);
178# ifdef __MATH_DECLARE_LDOUBLE
179# ifdef __NO_LONG_DOUBLE_MATH
180extern long double __REDIRECT_NTH (hypotl, (long double, long double),
181 __hypot_finite);
182# else
183extern long double __REDIRECT_NTH (hypotl, (long double, long double),
184 __hypotl_finite);
185# endif
186# endif
187#endif
188
189#if defined __USE_MISC || defined __USE_XOPEN
190/* j0. */
191extern double __REDIRECT_NTH (j0, (double), __j0_finite);
192#endif
193#if defined __USE_MISC && defined __USE_ISOC99
194extern float __REDIRECT_NTH (j0f, (float), __j0f_finite);
195# ifdef __MATH_DECLARE_LDOUBLE
196# ifdef __NO_LONG_DOUBLE_MATH
197extern long double __REDIRECT_NTH (j0l, (long double), __j0_finite);
198# else
199extern long double __REDIRECT_NTH (j0l, (long double), __j0l_finite);
200# endif
201# endif
202#endif
203
204#if defined __USE_MISC || defined __USE_XOPEN
205/* y0. */
206extern double __REDIRECT_NTH (y0, (double), __y0_finite);
207#endif
208#if defined __USE_MISC && defined __USE_ISOC99
209extern float __REDIRECT_NTH (y0f, (float), __y0f_finite);
210# ifdef __MATH_DECLARE_LDOUBLE
211# ifdef __NO_LONG_DOUBLE_MATH
212extern long double __REDIRECT_NTH (y0l, (long double), __y0_finite);
213# else
214extern long double __REDIRECT_NTH (y0l, (long double), __y0l_finite);
215# endif
216# endif
217#endif
218
219#if defined __USE_MISC || defined __USE_XOPEN
220/* j1. */
221extern double __REDIRECT_NTH (j1, (double), __j1_finite);
222#endif
223#if defined __USE_MISC && defined __USE_ISOC99
224extern float __REDIRECT_NTH (j1f, (float), __j1f_finite);
225# ifdef __MATH_DECLARE_LDOUBLE
226# ifdef __NO_LONG_DOUBLE_MATH
227extern long double __REDIRECT_NTH (j1l, (long double), __j1_finite);
228# else
229extern long double __REDIRECT_NTH (j1l, (long double), __j1l_finite);
230# endif
231# endif
232#endif
233
234#if defined __USE_MISC || defined __USE_XOPEN
235/* y1. */
236extern double __REDIRECT_NTH (y1, (double), __y1_finite);
237#endif
238#if defined __USE_MISC && defined __USE_ISOC99
239extern float __REDIRECT_NTH (y1f, (float), __y1f_finite);
240# ifdef __MATH_DECLARE_LDOUBLE
241# ifdef __NO_LONG_DOUBLE_MATH
242extern long double __REDIRECT_NTH (y1l, (long double), __y1_finite);
243# else
244extern long double __REDIRECT_NTH (y1l, (long double), __y1l_finite);
245# endif
246# endif
247#endif
248
249#if defined __USE_MISC || defined __USE_XOPEN
250/* jn. */
251extern double __REDIRECT_NTH (jn, (int, double), __jn_finite);
252#endif
253#if defined __USE_MISC && defined __USE_ISOC99
254extern float __REDIRECT_NTH (jnf, (int, float), __jnf_finite);
255# ifdef __MATH_DECLARE_LDOUBLE
256# ifdef __NO_LONG_DOUBLE_MATH
257extern long double __REDIRECT_NTH (jnl, (int, long double), __jn_finite);
258# else
259extern long double __REDIRECT_NTH (jnl, (int, long double), __jnl_finite);
260# endif
261# endif
262#endif
263
264#if defined __USE_MISC || defined __USE_XOPEN
265/* yn. */
266extern double __REDIRECT_NTH (yn, (int, double), __yn_finite);
267#endif
268#if defined __USE_MISC && defined __USE_ISOC99
269extern float __REDIRECT_NTH (ynf, (int, float), __ynf_finite);
270# ifdef __MATH_DECLARE_LDOUBLE
271# ifdef __NO_LONG_DOUBLE_MATH
272extern long double __REDIRECT_NTH (ynl, (int, long double), __yn_finite);
273# else
274extern long double __REDIRECT_NTH (ynl, (int, long double), __ynl_finite);
275# endif
276# endif
277#endif
278
279#ifdef __USE_MISC
280/* lgamma_r. */
281extern double __REDIRECT_NTH (lgamma_r, (double, int *), __lgamma_r_finite);
282# ifdef __USE_ISOC99
283extern float __REDIRECT_NTH (lgammaf_r, (float, int *), __lgammaf_r_finite);
284# ifdef __MATH_DECLARE_LDOUBLE
285# ifdef __NO_LONG_DOUBLE_MATH
286extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
287 __lgamma_r_finite);
288# else
289extern long double __REDIRECT_NTH (lgammal_r, (long double, int *),
290 __lgammal_r_finite);
291# endif
292# endif
293# endif
294#endif
295
296extern double __lgamma_r_finite (double, int *);
297extern float __lgammaf_r_finite (float, int *);
298#ifdef __NO_LONG_DOUBLE_MATH
299extern long double __REDIRECT_NTH (__lgammal_r_finite, (long double, int *),
300 __lgamma_r_finite);
301#else
302extern long double __lgammal_r_finite (long double, int *);
303#endif
304
305#if ((defined __USE_XOPEN || defined __USE_ISOC99) \
306 && defined __extern_always_inline)
307/* lgamma. */
308__extern_always_inline double __NTH (lgamma (double __d))
309{
310# if defined __USE_MISC || defined __USE_XOPEN
311 return __lgamma_r_finite (__d, &signgam);
312# else
313 int __local_signgam = 0;
314 return __lgamma_r_finite (__d, &__local_signgam);
315# endif
316}
317#endif
318#if defined __USE_ISOC99 && defined __extern_always_inline
319__extern_always_inline float __NTH (lgammaf (float __d))
320{
321# if defined __USE_MISC || defined __USE_XOPEN
322 return __lgammaf_r_finite (__d, &signgam);
323# else
324 int __local_signgam = 0;
325 return __lgammaf_r_finite (__d, &__local_signgam);
326# endif
327}
328# ifdef __MATH_DECLARE_LDOUBLE
329__extern_always_inline long double __NTH (lgammal (long double __d))
330{
331# if defined __USE_MISC || defined __USE_XOPEN
332 return __lgammal_r_finite (__d, &signgam);
333# else
334 int __local_signgam = 0;
335 return __lgammal_r_finite (__d, &__local_signgam);
336# endif
337}
338# endif
339#endif
340
341#if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \
342 && defined __extern_always_inline)
343/* gamma. */
344__extern_always_inline double __NTH (gamma (double __d))
345{
346 return __lgamma_r_finite (__d, &signgam);
347}
348# ifdef __USE_ISOC99
349__extern_always_inline float __NTH (gammaf (float __d))
350{
351 return __lgammaf_r_finite (__d, &signgam);
352}
353# ifdef __MATH_DECLARE_LDOUBLE
354__extern_always_inline long double __NTH (gammal (long double __d))
355{
356 return __lgammal_r_finite (__d, &signgam);
357}
358# endif
359# endif
360#endif
361
362/* log. */
363extern double __REDIRECT_NTH (log, (double), __log_finite);
364#ifdef __USE_ISOC99
365extern float __REDIRECT_NTH (logf, (float), __logf_finite);
366# ifdef __MATH_DECLARE_LDOUBLE
367# ifdef __NO_LONG_DOUBLE_MATH
368extern long double __REDIRECT_NTH (logl, (long double), __log_finite);
369# else
370extern long double __REDIRECT_NTH (logl, (long double), __logl_finite);
371# endif
372# endif
373#endif
374
375/* log10. */
376extern double __REDIRECT_NTH (log10, (double), __log10_finite);
377#ifdef __USE_ISOC99
378extern float __REDIRECT_NTH (log10f, (float), __log10f_finite);
379# ifdef __MATH_DECLARE_LDOUBLE
380# ifdef __NO_LONG_DOUBLE_MATH
381extern long double __REDIRECT_NTH (log10l, (long double), __log10_finite);
382# else
383extern long double __REDIRECT_NTH (log10l, (long double), __log10l_finite);
384# endif
385# endif
386#endif
387
388#ifdef __USE_ISOC99
389/* log2. */
390extern double __REDIRECT_NTH (log2, (double), __log2_finite);
391extern float __REDIRECT_NTH (log2f, (float), __log2f_finite);
392# ifdef __MATH_DECLARE_LDOUBLE
393# ifdef __NO_LONG_DOUBLE_MATH
394extern long double __REDIRECT_NTH (log2l, (long double), __log2_finite);
395# else
396extern long double __REDIRECT_NTH (log2l, (long double), __log2l_finite);
397# endif
398# endif
399#endif
400
401/* pow. */
402extern double __REDIRECT_NTH (pow, (double, double), __pow_finite);
403#ifdef __USE_ISOC99
404extern float __REDIRECT_NTH (powf, (float, float), __powf_finite);
405# ifdef __MATH_DECLARE_LDOUBLE
406# ifdef __NO_LONG_DOUBLE_MATH
407extern long double __REDIRECT_NTH (powl, (long double, long double),
408 __pow_finite);
409# else
410extern long double __REDIRECT_NTH (powl, (long double, long double),
411 __powl_finite);
412# endif
413# endif
414#endif
415
416#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
417/* remainder. */
418extern double __REDIRECT_NTH (remainder, (double, double), __remainder_finite);
419#endif
420#ifdef __USE_ISOC99
421extern float __REDIRECT_NTH (remainderf, (float, float), __remainderf_finite);
422# ifdef __MATH_DECLARE_LDOUBLE
423# ifdef __NO_LONG_DOUBLE_MATH
424extern long double __REDIRECT_NTH (remainderl, (long double, long double),
425 __remainder_finite);
426# else
427extern long double __REDIRECT_NTH (remainderl, (long double, long double),
428 __remainderl_finite);
429# endif
430# endif
431#endif
432
433#if (defined __USE_MISC \
434 || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))
435/* scalb. */
436extern double __REDIRECT_NTH (scalb, (double, double), __scalb_finite);
437#endif
438#if defined __USE_MISC && defined __USE_ISOC99
439extern float __REDIRECT_NTH (scalbf, (float, float), __scalbf_finite);
440# ifdef __MATH_DECLARE_LDOUBLE
441# ifdef __NO_LONG_DOUBLE_MATH
442extern long double __REDIRECT_NTH (scalbl, (long double, long double),
443 __scalb_finite);
444# else
445extern long double __REDIRECT_NTH (scalbl, (long double, long double),
446 __scalbl_finite);
447# endif
448# endif
449#endif
450
451/* sinh. */
452extern double __REDIRECT_NTH (sinh, (double), __sinh_finite);
453#ifdef __USE_ISOC99
454extern float __REDIRECT_NTH (sinhf, (float), __sinhf_finite);
455# ifdef __MATH_DECLARE_LDOUBLE
456# ifdef __NO_LONG_DOUBLE_MATH
457extern long double __REDIRECT_NTH (sinhl, (long double), __sinh_finite);
458# else
459extern long double __REDIRECT_NTH (sinhl, (long double), __sinhl_finite);
460# endif
461# endif
462#endif
463
464/* sqrt. */
465extern double __REDIRECT_NTH (sqrt, (double), __sqrt_finite);
466#ifdef __USE_ISOC99
467extern float __REDIRECT_NTH (sqrtf, (float), __sqrtf_finite);
468# ifdef __MATH_DECLARE_LDOUBLE
469# ifdef __NO_LONG_DOUBLE_MATH
470extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrt_finite);
471# else
472extern long double __REDIRECT_NTH (sqrtl, (long double), __sqrtl_finite);
473# endif
474# endif
475#endif
476
477#if defined __USE_ISOC99 && defined __extern_always_inline
478/* tgamma. */
479extern double __gamma_r_finite (double, int *);
480__extern_always_inline double __NTH (tgamma (double __d))
481{
482 int __local_signgam = 0;
483 double __res = __gamma_r_finite (__d, &__local_signgam);
484 return __local_signgam < 0 ? -__res : __res;
485}
486extern float __gammaf_r_finite (float, int *);
487__extern_always_inline float __NTH (tgammaf (float __d))
488{
489 int __local_signgam = 0;
490 float __res = __gammaf_r_finite (__d, &__local_signgam);
491 return __local_signgam < 0 ? -__res : __res;
492}
493# ifdef __MATH_DECLARE_LDOUBLE
494extern long double __gammal_r_finite (long double, int *);
495__extern_always_inline long double __NTH (tgammal (long double __d))
496{
497 int __local_signgam = 0;
498# ifdef __NO_LONG_DOUBLE_MATH
499 long double __res = __gamma_r_finite (__d, &__local_signgam);
500# else
501 long double __res = __gammal_r_finite (__d, &__local_signgam);
502# endif
503 return __local_signgam < 0 ? -__res : __res;
504}
505# endif
506#endif