1 /* Entry points to finite-math-only compiler runs.
2 Copyright (C) 2011-2018 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/>. */
20 # error "Never use <bits/math-finite.h> directly; include <math.h> instead."
23 #define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__)
25 #define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__)
27 #define __MATH_REDIRCALL_X(from, args, to) \
28 extern _Mdouble_ __REDIRECT_NTH (from, args, to)
29 #define __MATH_REDIRCALL(function, reentrant, args) \
31 (__REDIRFROM (function, reentrant), args, \
32 __REDIRTO (function, reentrant))
33 #define __MATH_REDIRCALL_2(from, reentrant, args, to) \
35 (__REDIRFROM (from, reentrant), args, \
36 __REDIRTO (to, reentrant))
38 #define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \
40 (__REDIRFROM (__CONCAT (__, function), \
41 __CONCAT (reentrant, _finite)), \
42 args, __REDIRTO (function, _r))
46 __MATH_REDIRCALL (acos, , (_Mdouble_));
48 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
50 __MATH_REDIRCALL (acosh, , (_Mdouble_));
54 __MATH_REDIRCALL (asin, , (_Mdouble_));
57 __MATH_REDIRCALL (atan2, , (_Mdouble_, _Mdouble_));
59 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
61 __MATH_REDIRCALL (atanh, , (_Mdouble_));
65 __MATH_REDIRCALL (cosh, , (_Mdouble_));
68 __MATH_REDIRCALL (exp, , (_Mdouble_));
70 #if __GLIBC_USE (IEC_60559_FUNCS_EXT)
72 __MATH_REDIRCALL (exp10, , (_Mdouble_));
77 __MATH_REDIRCALL (exp2, , (_Mdouble_));
81 __MATH_REDIRCALL (fmod, , (_Mdouble_, _Mdouble_));
83 #if defined __USE_XOPEN || defined __USE_ISOC99
85 __MATH_REDIRCALL (hypot, , (_Mdouble_, _Mdouble_));
88 #if (__MATH_DECLARING_DOUBLE && (defined __USE_MISC || defined __USE_XOPEN)) \
89 || (!__MATH_DECLARING_DOUBLE && defined __USE_MISC)
91 __MATH_REDIRCALL (j0, , (_Mdouble_));
94 __MATH_REDIRCALL (y0, , (_Mdouble_));
97 __MATH_REDIRCALL (j1, , (_Mdouble_));
100 __MATH_REDIRCALL (y1, , (_Mdouble_));
103 __MATH_REDIRCALL (jn, , (int, _Mdouble_));
106 __MATH_REDIRCALL (yn, , (int, _Mdouble_));
111 __MATH_REDIRCALL (lgamma, _r, (_Mdouble_, int *));
114 /* Redirect __lgammal_r_finite to __lgamma_r_finite when __NO_LONG_DOUBLE_MATH
115 is set and to itself otherwise. It also redirects __lgamma_r_finite and
116 __lgammaf_r_finite to themselves. */
117 __MATH_REDIRCALL_INTERNAL (lgamma, _r, (_Mdouble_, int *));
119 #if ((defined __USE_XOPEN || defined __USE_ISOC99) \
120 && defined __extern_always_inline)
122 __extern_always_inline _Mdouble_
123 __NTH (__REDIRFROM (lgamma, ) (_Mdouble_ __d))
125 # if defined __USE_MISC || defined __USE_XOPEN
126 return __REDIRTO (lgamma, _r) (__d, &signgam);
128 int __local_signgam = 0;
129 return __REDIRTO (lgamma, _r) (__d, &__local_signgam);
134 #if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \
135 && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN
137 __extern_always_inline _Mdouble_
138 __NTH (__REDIRFROM (gamma, ) (_Mdouble_ __d))
140 return __REDIRTO (lgamma, _r) (__d, &signgam);
145 __MATH_REDIRCALL (log, , (_Mdouble_));
148 __MATH_REDIRCALL (log10, , (_Mdouble_));
152 __MATH_REDIRCALL (log2, , (_Mdouble_));
156 __MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_));
158 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
160 __MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_));
163 #if ((__MATH_DECLARING_DOUBLE \
164 && (defined __USE_MISC \
165 || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))) \
166 || (!defined __MATH_DECLARE_LDOUBLE && defined __USE_MISC)) \
167 && !__MATH_DECLARING_FLOATN
169 __MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_));
173 __MATH_REDIRCALL (sinh, , (_Mdouble_));
176 __MATH_REDIRCALL (sqrt, , (_Mdouble_));
178 #if defined __USE_ISOC99 && defined __extern_always_inline
181 __REDIRFROM (__gamma, _r_finite) (_Mdouble_, int *);
183 __extern_always_inline _Mdouble_
184 __NTH (__REDIRFROM (tgamma, ) (_Mdouble_ __d))
186 int __local_signgam = 0;
187 _Mdouble_ __res = __REDIRTO (gamma, _r) (__d, &__local_signgam);
188 return __local_signgam < 0 ? -__res : __res;
194 #undef __MATH_REDIRCALL
195 #undef __MATH_REDIRCALL_2
196 #undef __MATH_REDIRCALL_INTERNAL
197 #undef __MATH_REDIRCALL_X