Remove powerpc, sparc fdim inlines (bug 22987).
[glibc.git] / math / bits / math-finite.h
blob0799fe7b29e6e1c4a3f2dc68054b039ae0a6d08a
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/>. */
19 #ifndef _MATH_H
20 # error "Never use <bits/math-finite.h> directly; include <math.h> instead."
21 #endif
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) \
30 __MATH_REDIRCALL_X \
31 (__REDIRFROM (function, reentrant), args, \
32 __REDIRTO (function, reentrant))
33 #define __MATH_REDIRCALL_2(from, reentrant, args, to) \
34 __MATH_REDIRCALL_X \
35 (__REDIRFROM (from, reentrant), args, \
36 __REDIRTO (to, reentrant))
38 #define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \
39 __MATH_REDIRCALL_X \
40 (__REDIRFROM (__CONCAT (__, function), \
41 __CONCAT (reentrant, _finite)), \
42 args, __REDIRTO (function, _r))
45 /* acos. */
46 __MATH_REDIRCALL (acos, , (_Mdouble_));
48 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
49 /* acosh. */
50 __MATH_REDIRCALL (acosh, , (_Mdouble_));
51 #endif
53 /* asin. */
54 __MATH_REDIRCALL (asin, , (_Mdouble_));
56 /* atan2. */
57 __MATH_REDIRCALL (atan2, , (_Mdouble_, _Mdouble_));
59 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
60 /* atanh. */
61 __MATH_REDIRCALL (atanh, , (_Mdouble_));
62 #endif
64 /* cosh. */
65 __MATH_REDIRCALL (cosh, , (_Mdouble_));
67 /* exp. */
68 __MATH_REDIRCALL (exp, , (_Mdouble_));
70 #if __GLIBC_USE (IEC_60559_FUNCS_EXT)
71 /* exp10. */
72 __MATH_REDIRCALL (exp10, , (_Mdouble_));
73 #endif
75 #ifdef __USE_ISOC99
76 /* exp2. */
77 __MATH_REDIRCALL (exp2, , (_Mdouble_));
78 #endif
80 /* fmod. */
81 __MATH_REDIRCALL (fmod, , (_Mdouble_, _Mdouble_));
83 #if defined __USE_XOPEN || defined __USE_ISOC99
84 /* hypot. */
85 __MATH_REDIRCALL (hypot, , (_Mdouble_, _Mdouble_));
86 #endif
88 #if (__MATH_DECLARING_DOUBLE && (defined __USE_MISC || defined __USE_XOPEN)) \
89 || (!__MATH_DECLARING_DOUBLE && defined __USE_MISC)
90 /* j0. */
91 __MATH_REDIRCALL (j0, , (_Mdouble_));
93 /* y0. */
94 __MATH_REDIRCALL (y0, , (_Mdouble_));
96 /* j1. */
97 __MATH_REDIRCALL (j1, , (_Mdouble_));
99 /* y1. */
100 __MATH_REDIRCALL (y1, , (_Mdouble_));
102 /* jn. */
103 __MATH_REDIRCALL (jn, , (int, _Mdouble_));
105 /* yn. */
106 __MATH_REDIRCALL (yn, , (int, _Mdouble_));
107 #endif
109 #ifdef __USE_MISC
110 /* lgamma_r. */
111 __MATH_REDIRCALL (lgamma, _r, (_Mdouble_, int *));
112 #endif
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)
121 /* lgamma. */
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);
127 # else
128 int __local_signgam = 0;
129 return __REDIRTO (lgamma, _r) (__d, &__local_signgam);
130 # endif
132 #endif
134 #if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \
135 && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN
136 /* gamma. */
137 __extern_always_inline _Mdouble_
138 __NTH (__REDIRFROM (gamma, ) (_Mdouble_ __d))
140 return __REDIRTO (lgamma, _r) (__d, &signgam);
142 #endif
144 /* log. */
145 __MATH_REDIRCALL (log, , (_Mdouble_));
147 /* log10. */
148 __MATH_REDIRCALL (log10, , (_Mdouble_));
150 #ifdef __USE_ISOC99
151 /* log2. */
152 __MATH_REDIRCALL (log2, , (_Mdouble_));
153 #endif
155 /* pow. */
156 __MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_));
158 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
159 /* remainder. */
160 __MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_));
161 #endif
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
168 /* scalb. */
169 __MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_));
170 #endif
172 /* sinh. */
173 __MATH_REDIRCALL (sinh, , (_Mdouble_));
175 /* sqrt. */
176 __MATH_REDIRCALL (sqrt, , (_Mdouble_));
178 #if defined __USE_ISOC99 && defined __extern_always_inline
179 /* tgamma. */
180 extern _Mdouble_
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;
190 #endif
192 #undef __REDIRFROM
193 #undef __REDIRTO
194 #undef __MATH_REDIRCALL
195 #undef __MATH_REDIRCALL_2
196 #undef __MATH_REDIRCALL_INTERNAL
197 #undef __MATH_REDIRCALL_X