]>
Commit | Line | Data |
---|---|---|
0ac5ae23 | 1 | /* Entry points to finite-math-only compiler runs. |
04277e02 | 2 | Copyright (C) 2011-2019 Free Software Foundation, Inc. |
0ac5ae23 UD |
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 | |
59ba27a6 PE |
16 | License along with the GNU C Library; if not, see |
17 | <http://www.gnu.org/licenses/>. */ | |
0ac5ae23 UD |
18 | |
19 | #ifndef _MATH_H | |
20 | # error "Never use <bits/math-finite.h> directly; include <math.h> instead." | |
21 | #endif | |
22 | ||
f264cca5 GG |
23 | #define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__) |
24 | ||
f264cca5 GG |
25 | #define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__) |
26 | ||
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 \ | |
7daada03 JM |
31 | (__REDIRFROM (function, reentrant), args, \ |
32 | __REDIRTO (function, reentrant)) | |
f264cca5 GG |
33 | #define __MATH_REDIRCALL_2(from, reentrant, args, to) \ |
34 | __MATH_REDIRCALL_X \ | |
7daada03 JM |
35 | (__REDIRFROM (from, reentrant), args, \ |
36 | __REDIRTO (to, reentrant)) | |
f264cca5 GG |
37 | |
38 | #define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \ | |
39 | __MATH_REDIRCALL_X \ | |
40 | (__REDIRFROM (__CONCAT (__, function), \ | |
7daada03 JM |
41 | __CONCAT (reentrant, _finite)), \ |
42 | args, __REDIRTO (function, _r)) | |
f264cca5 GG |
43 | |
44 | ||
45 | /* acos. */ | |
46 | __MATH_REDIRCALL (acos, , (_Mdouble_)); | |
0ac5ae23 | 47 | |
acd7f096 | 48 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
0ac5ae23 | 49 | /* acosh. */ |
f264cca5 | 50 | __MATH_REDIRCALL (acosh, , (_Mdouble_)); |
0ac5ae23 UD |
51 | #endif |
52 | ||
53 | /* asin. */ | |
f264cca5 | 54 | __MATH_REDIRCALL (asin, , (_Mdouble_)); |
0ac5ae23 UD |
55 | |
56 | /* atan2. */ | |
f264cca5 | 57 | __MATH_REDIRCALL (atan2, , (_Mdouble_, _Mdouble_)); |
0ac5ae23 | 58 | |
acd7f096 | 59 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
0ac5ae23 | 60 | /* atanh. */ |
f264cca5 | 61 | __MATH_REDIRCALL (atanh, , (_Mdouble_)); |
0ac5ae23 UD |
62 | #endif |
63 | ||
64 | /* cosh. */ | |
f264cca5 | 65 | __MATH_REDIRCALL (cosh, , (_Mdouble_)); |
0ac5ae23 | 66 | |
bcf01e6d | 67 | /* exp. */ |
f264cca5 | 68 | __MATH_REDIRCALL (exp, , (_Mdouble_)); |
bcf01e6d | 69 | |
f3a129b8 | 70 | #if __GLIBC_USE (IEC_60559_FUNCS_EXT) |
0ac5ae23 | 71 | /* exp10. */ |
f264cca5 | 72 | __MATH_REDIRCALL (exp10, , (_Mdouble_)); |
0ac5ae23 UD |
73 | #endif |
74 | ||
75 | #ifdef __USE_ISOC99 | |
76 | /* exp2. */ | |
f264cca5 | 77 | __MATH_REDIRCALL (exp2, , (_Mdouble_)); |
0ac5ae23 UD |
78 | #endif |
79 | ||
80 | /* fmod. */ | |
f264cca5 | 81 | __MATH_REDIRCALL (fmod, , (_Mdouble_, _Mdouble_)); |
0ac5ae23 | 82 | |
3bfee8be | 83 | #if defined __USE_XOPEN || defined __USE_ISOC99 |
0ac5ae23 | 84 | /* hypot. */ |
f264cca5 | 85 | __MATH_REDIRCALL (hypot, , (_Mdouble_, _Mdouble_)); |
0ac5ae23 UD |
86 | #endif |
87 | ||
f264cca5 GG |
88 | #if (__MATH_DECLARING_DOUBLE && (defined __USE_MISC || defined __USE_XOPEN)) \ |
89 | || (!__MATH_DECLARING_DOUBLE && defined __USE_MISC) | |
0ac5ae23 | 90 | /* j0. */ |
f264cca5 | 91 | __MATH_REDIRCALL (j0, , (_Mdouble_)); |
0ac5ae23 UD |
92 | |
93 | /* y0. */ | |
f264cca5 | 94 | __MATH_REDIRCALL (y0, , (_Mdouble_)); |
0ac5ae23 UD |
95 | |
96 | /* j1. */ | |
f264cca5 | 97 | __MATH_REDIRCALL (j1, , (_Mdouble_)); |
0ac5ae23 UD |
98 | |
99 | /* y1. */ | |
f264cca5 | 100 | __MATH_REDIRCALL (y1, , (_Mdouble_)); |
0ac5ae23 UD |
101 | |
102 | /* jn. */ | |
f264cca5 | 103 | __MATH_REDIRCALL (jn, , (int, _Mdouble_)); |
0ac5ae23 UD |
104 | |
105 | /* yn. */ | |
f264cca5 | 106 | __MATH_REDIRCALL (yn, , (int, _Mdouble_)); |
0ac5ae23 UD |
107 | #endif |
108 | ||
109 | #ifdef __USE_MISC | |
110 | /* lgamma_r. */ | |
f264cca5 | 111 | __MATH_REDIRCALL (lgamma, _r, (_Mdouble_, int *)); |
0ac5ae23 UD |
112 | #endif |
113 | ||
f264cca5 GG |
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 *)); | |
3bfee8be | 118 | |
884ddc50 SP |
119 | #if ((defined __USE_XOPEN || defined __USE_ISOC99) \ |
120 | && defined __extern_always_inline) | |
0ac5ae23 | 121 | /* lgamma. */ |
f264cca5 | 122 | __extern_always_inline _Mdouble_ |
7daada03 | 123 | __NTH (__REDIRFROM (lgamma, ) (_Mdouble_ __d)) |
0ac5ae23 | 124 | { |
939fdd1c | 125 | # if defined __USE_MISC || defined __USE_XOPEN |
7daada03 | 126 | return __REDIRTO (lgamma, _r) (__d, &signgam); |
939fdd1c | 127 | # else |
0ac5ae23 | 128 | int __local_signgam = 0; |
7daada03 | 129 | return __REDIRTO (lgamma, _r) (__d, &__local_signgam); |
0ac5ae23 UD |
130 | # endif |
131 | } | |
3bfee8be | 132 | #endif |
0ac5ae23 | 133 | |
3bfee8be | 134 | #if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \ |
33d523d7 | 135 | && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN |
0ac5ae23 | 136 | /* gamma. */ |
f264cca5 | 137 | __extern_always_inline _Mdouble_ |
7daada03 | 138 | __NTH (__REDIRFROM (gamma, ) (_Mdouble_ __d)) |
0ac5ae23 | 139 | { |
7daada03 | 140 | return __REDIRTO (lgamma, _r) (__d, &signgam); |
0ac5ae23 | 141 | } |
0ac5ae23 UD |
142 | #endif |
143 | ||
144 | /* log. */ | |
f264cca5 | 145 | __MATH_REDIRCALL (log, , (_Mdouble_)); |
0ac5ae23 UD |
146 | |
147 | /* log10. */ | |
f264cca5 | 148 | __MATH_REDIRCALL (log10, , (_Mdouble_)); |
0ac5ae23 UD |
149 | |
150 | #ifdef __USE_ISOC99 | |
151 | /* log2. */ | |
f264cca5 | 152 | __MATH_REDIRCALL (log2, , (_Mdouble_)); |
0ac5ae23 UD |
153 | #endif |
154 | ||
155 | /* pow. */ | |
f264cca5 | 156 | __MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_)); |
0ac5ae23 | 157 | |
3bfee8be | 158 | #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 |
0ac5ae23 | 159 | /* remainder. */ |
f264cca5 | 160 | __MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_)); |
0ac5ae23 UD |
161 | #endif |
162 | ||
33d523d7 GG |
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 | |
0ac5ae23 | 168 | /* scalb. */ |
f264cca5 | 169 | __MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_)); |
0ac5ae23 UD |
170 | #endif |
171 | ||
172 | /* sinh. */ | |
f264cca5 | 173 | __MATH_REDIRCALL (sinh, , (_Mdouble_)); |
0ac5ae23 UD |
174 | |
175 | /* sqrt. */ | |
f264cca5 | 176 | __MATH_REDIRCALL (sqrt, , (_Mdouble_)); |
0ac5ae23 | 177 | |
884ddc50 | 178 | #if defined __USE_ISOC99 && defined __extern_always_inline |
0ac5ae23 | 179 | /* tgamma. */ |
f264cca5 | 180 | extern _Mdouble_ |
7daada03 | 181 | __REDIRFROM (__gamma, _r_finite) (_Mdouble_, int *); |
f264cca5 GG |
182 | |
183 | __extern_always_inline _Mdouble_ | |
7daada03 | 184 | __NTH (__REDIRFROM (tgamma, ) (_Mdouble_ __d)) |
0ac5ae23 UD |
185 | { |
186 | int __local_signgam = 0; | |
7daada03 | 187 | _Mdouble_ __res = __REDIRTO (gamma, _r) (__d, &__local_signgam); |
0ac5ae23 UD |
188 | return __local_signgam < 0 ? -__res : __res; |
189 | } | |
0ac5ae23 | 190 | #endif |
f264cca5 GG |
191 | |
192 | #undef __REDIRFROM | |
f264cca5 | 193 | #undef __REDIRTO |
f264cca5 GG |
194 | #undef __MATH_REDIRCALL |
195 | #undef __MATH_REDIRCALL_2 | |
196 | #undef __MATH_REDIRCALL_INTERNAL | |
197 | #undef __MATH_REDIRCALL_X |