1*700637cbSDimitry Andric // -*- C++ -*-
2*700637cbSDimitry Andric //===----------------------------------------------------------------------===//
3*700637cbSDimitry Andric //
4*700637cbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*700637cbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
6*700637cbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*700637cbSDimitry Andric //
8*700637cbSDimitry Andric //===----------------------------------------------------------------------===//
9*700637cbSDimitry Andric
10*700637cbSDimitry Andric #ifndef _LIBCPP___CXX03_MATH_H
11*700637cbSDimitry Andric # define _LIBCPP___CXX03_MATH_H
12*700637cbSDimitry Andric
13*700637cbSDimitry Andric /*
14*700637cbSDimitry Andric math.h synopsis
15*700637cbSDimitry Andric
16*700637cbSDimitry Andric Macros:
17*700637cbSDimitry Andric
18*700637cbSDimitry Andric HUGE_VAL
19*700637cbSDimitry Andric HUGE_VALF // C99
20*700637cbSDimitry Andric HUGE_VALL // C99
21*700637cbSDimitry Andric INFINITY // C99
22*700637cbSDimitry Andric NAN // C99
23*700637cbSDimitry Andric FP_INFINITE // C99
24*700637cbSDimitry Andric FP_NAN // C99
25*700637cbSDimitry Andric FP_NORMAL // C99
26*700637cbSDimitry Andric FP_SUBNORMAL // C99
27*700637cbSDimitry Andric FP_ZERO // C99
28*700637cbSDimitry Andric FP_FAST_FMA // C99
29*700637cbSDimitry Andric FP_FAST_FMAF // C99
30*700637cbSDimitry Andric FP_FAST_FMAL // C99
31*700637cbSDimitry Andric FP_ILOGB0 // C99
32*700637cbSDimitry Andric FP_ILOGBNAN // C99
33*700637cbSDimitry Andric MATH_ERRNO // C99
34*700637cbSDimitry Andric MATH_ERREXCEPT // C99
35*700637cbSDimitry Andric math_errhandling // C99
36*700637cbSDimitry Andric
37*700637cbSDimitry Andric Types:
38*700637cbSDimitry Andric
39*700637cbSDimitry Andric float_t // C99
40*700637cbSDimitry Andric double_t // C99
41*700637cbSDimitry Andric
42*700637cbSDimitry Andric // C90
43*700637cbSDimitry Andric
44*700637cbSDimitry Andric floating_point abs(floating_point x);
45*700637cbSDimitry Andric
46*700637cbSDimitry Andric floating_point acos (arithmetic x);
47*700637cbSDimitry Andric float acosf(float x);
48*700637cbSDimitry Andric long double acosl(long double x);
49*700637cbSDimitry Andric
50*700637cbSDimitry Andric floating_point asin (arithmetic x);
51*700637cbSDimitry Andric float asinf(float x);
52*700637cbSDimitry Andric long double asinl(long double x);
53*700637cbSDimitry Andric
54*700637cbSDimitry Andric floating_point atan (arithmetic x);
55*700637cbSDimitry Andric float atanf(float x);
56*700637cbSDimitry Andric long double atanl(long double x);
57*700637cbSDimitry Andric
58*700637cbSDimitry Andric floating_point atan2 (arithmetic y, arithmetic x);
59*700637cbSDimitry Andric float atan2f(float y, float x);
60*700637cbSDimitry Andric long double atan2l(long double y, long double x);
61*700637cbSDimitry Andric
62*700637cbSDimitry Andric floating_point ceil (arithmetic x);
63*700637cbSDimitry Andric float ceilf(float x);
64*700637cbSDimitry Andric long double ceill(long double x);
65*700637cbSDimitry Andric
66*700637cbSDimitry Andric floating_point cos (arithmetic x);
67*700637cbSDimitry Andric float cosf(float x);
68*700637cbSDimitry Andric long double cosl(long double x);
69*700637cbSDimitry Andric
70*700637cbSDimitry Andric floating_point cosh (arithmetic x);
71*700637cbSDimitry Andric float coshf(float x);
72*700637cbSDimitry Andric long double coshl(long double x);
73*700637cbSDimitry Andric
74*700637cbSDimitry Andric floating_point exp (arithmetic x);
75*700637cbSDimitry Andric float expf(float x);
76*700637cbSDimitry Andric long double expl(long double x);
77*700637cbSDimitry Andric
78*700637cbSDimitry Andric floating_point fabs (arithmetic x);
79*700637cbSDimitry Andric float fabsf(float x);
80*700637cbSDimitry Andric long double fabsl(long double x);
81*700637cbSDimitry Andric
82*700637cbSDimitry Andric floating_point floor (arithmetic x);
83*700637cbSDimitry Andric float floorf(float x);
84*700637cbSDimitry Andric long double floorl(long double x);
85*700637cbSDimitry Andric
86*700637cbSDimitry Andric floating_point fmod (arithmetic x, arithmetic y);
87*700637cbSDimitry Andric float fmodf(float x, float y);
88*700637cbSDimitry Andric long double fmodl(long double x, long double y);
89*700637cbSDimitry Andric
90*700637cbSDimitry Andric floating_point frexp (arithmetic value, int* exp);
91*700637cbSDimitry Andric float frexpf(float value, int* exp);
92*700637cbSDimitry Andric long double frexpl(long double value, int* exp);
93*700637cbSDimitry Andric
94*700637cbSDimitry Andric floating_point ldexp (arithmetic value, int exp);
95*700637cbSDimitry Andric float ldexpf(float value, int exp);
96*700637cbSDimitry Andric long double ldexpl(long double value, int exp);
97*700637cbSDimitry Andric
98*700637cbSDimitry Andric floating_point log (arithmetic x);
99*700637cbSDimitry Andric float logf(float x);
100*700637cbSDimitry Andric long double logl(long double x);
101*700637cbSDimitry Andric
102*700637cbSDimitry Andric floating_point log10 (arithmetic x);
103*700637cbSDimitry Andric float log10f(float x);
104*700637cbSDimitry Andric long double log10l(long double x);
105*700637cbSDimitry Andric
106*700637cbSDimitry Andric floating_point modf (floating_point value, floating_point* iptr);
107*700637cbSDimitry Andric float modff(float value, float* iptr);
108*700637cbSDimitry Andric long double modfl(long double value, long double* iptr);
109*700637cbSDimitry Andric
110*700637cbSDimitry Andric floating_point pow (arithmetic x, arithmetic y);
111*700637cbSDimitry Andric float powf(float x, float y);
112*700637cbSDimitry Andric long double powl(long double x, long double y);
113*700637cbSDimitry Andric
114*700637cbSDimitry Andric floating_point sin (arithmetic x);
115*700637cbSDimitry Andric float sinf(float x);
116*700637cbSDimitry Andric long double sinl(long double x);
117*700637cbSDimitry Andric
118*700637cbSDimitry Andric floating_point sinh (arithmetic x);
119*700637cbSDimitry Andric float sinhf(float x);
120*700637cbSDimitry Andric long double sinhl(long double x);
121*700637cbSDimitry Andric
122*700637cbSDimitry Andric floating_point sqrt (arithmetic x);
123*700637cbSDimitry Andric float sqrtf(float x);
124*700637cbSDimitry Andric long double sqrtl(long double x);
125*700637cbSDimitry Andric
126*700637cbSDimitry Andric floating_point tan (arithmetic x);
127*700637cbSDimitry Andric float tanf(float x);
128*700637cbSDimitry Andric long double tanl(long double x);
129*700637cbSDimitry Andric
130*700637cbSDimitry Andric floating_point tanh (arithmetic x);
131*700637cbSDimitry Andric float tanhf(float x);
132*700637cbSDimitry Andric long double tanhl(long double x);
133*700637cbSDimitry Andric
134*700637cbSDimitry Andric // C99
135*700637cbSDimitry Andric
136*700637cbSDimitry Andric bool signbit(arithmetic x);
137*700637cbSDimitry Andric
138*700637cbSDimitry Andric int fpclassify(arithmetic x);
139*700637cbSDimitry Andric
140*700637cbSDimitry Andric bool isfinite(arithmetic x);
141*700637cbSDimitry Andric bool isinf(arithmetic x);
142*700637cbSDimitry Andric bool isnan(arithmetic x);
143*700637cbSDimitry Andric bool isnormal(arithmetic x);
144*700637cbSDimitry Andric
145*700637cbSDimitry Andric bool isgreater(arithmetic x, arithmetic y);
146*700637cbSDimitry Andric bool isgreaterequal(arithmetic x, arithmetic y);
147*700637cbSDimitry Andric bool isless(arithmetic x, arithmetic y);
148*700637cbSDimitry Andric bool islessequal(arithmetic x, arithmetic y);
149*700637cbSDimitry Andric bool islessgreater(arithmetic x, arithmetic y);
150*700637cbSDimitry Andric bool isunordered(arithmetic x, arithmetic y);
151*700637cbSDimitry Andric
152*700637cbSDimitry Andric floating_point acosh (arithmetic x);
153*700637cbSDimitry Andric float acoshf(float x);
154*700637cbSDimitry Andric long double acoshl(long double x);
155*700637cbSDimitry Andric
156*700637cbSDimitry Andric floating_point asinh (arithmetic x);
157*700637cbSDimitry Andric float asinhf(float x);
158*700637cbSDimitry Andric long double asinhl(long double x);
159*700637cbSDimitry Andric
160*700637cbSDimitry Andric floating_point atanh (arithmetic x);
161*700637cbSDimitry Andric float atanhf(float x);
162*700637cbSDimitry Andric long double atanhl(long double x);
163*700637cbSDimitry Andric
164*700637cbSDimitry Andric floating_point cbrt (arithmetic x);
165*700637cbSDimitry Andric float cbrtf(float x);
166*700637cbSDimitry Andric long double cbrtl(long double x);
167*700637cbSDimitry Andric
168*700637cbSDimitry Andric floating_point copysign (arithmetic x, arithmetic y);
169*700637cbSDimitry Andric float copysignf(float x, float y);
170*700637cbSDimitry Andric long double copysignl(long double x, long double y);
171*700637cbSDimitry Andric
172*700637cbSDimitry Andric floating_point erf (arithmetic x);
173*700637cbSDimitry Andric float erff(float x);
174*700637cbSDimitry Andric long double erfl(long double x);
175*700637cbSDimitry Andric
176*700637cbSDimitry Andric floating_point erfc (arithmetic x);
177*700637cbSDimitry Andric float erfcf(float x);
178*700637cbSDimitry Andric long double erfcl(long double x);
179*700637cbSDimitry Andric
180*700637cbSDimitry Andric floating_point exp2 (arithmetic x);
181*700637cbSDimitry Andric float exp2f(float x);
182*700637cbSDimitry Andric long double exp2l(long double x);
183*700637cbSDimitry Andric
184*700637cbSDimitry Andric floating_point expm1 (arithmetic x);
185*700637cbSDimitry Andric float expm1f(float x);
186*700637cbSDimitry Andric long double expm1l(long double x);
187*700637cbSDimitry Andric
188*700637cbSDimitry Andric floating_point fdim (arithmetic x, arithmetic y);
189*700637cbSDimitry Andric float fdimf(float x, float y);
190*700637cbSDimitry Andric long double fdiml(long double x, long double y);
191*700637cbSDimitry Andric
192*700637cbSDimitry Andric floating_point fma (arithmetic x, arithmetic y, arithmetic z);
193*700637cbSDimitry Andric float fmaf(float x, float y, float z);
194*700637cbSDimitry Andric long double fmal(long double x, long double y, long double z);
195*700637cbSDimitry Andric
196*700637cbSDimitry Andric floating_point fmax (arithmetic x, arithmetic y);
197*700637cbSDimitry Andric float fmaxf(float x, float y);
198*700637cbSDimitry Andric long double fmaxl(long double x, long double y);
199*700637cbSDimitry Andric
200*700637cbSDimitry Andric floating_point fmin (arithmetic x, arithmetic y);
201*700637cbSDimitry Andric float fminf(float x, float y);
202*700637cbSDimitry Andric long double fminl(long double x, long double y);
203*700637cbSDimitry Andric
204*700637cbSDimitry Andric floating_point hypot (arithmetic x, arithmetic y);
205*700637cbSDimitry Andric float hypotf(float x, float y);
206*700637cbSDimitry Andric long double hypotl(long double x, long double y);
207*700637cbSDimitry Andric
208*700637cbSDimitry Andric int ilogb (arithmetic x);
209*700637cbSDimitry Andric int ilogbf(float x);
210*700637cbSDimitry Andric int ilogbl(long double x);
211*700637cbSDimitry Andric
212*700637cbSDimitry Andric floating_point lgamma (arithmetic x);
213*700637cbSDimitry Andric float lgammaf(float x);
214*700637cbSDimitry Andric long double lgammal(long double x);
215*700637cbSDimitry Andric
216*700637cbSDimitry Andric long long llrint (arithmetic x);
217*700637cbSDimitry Andric long long llrintf(float x);
218*700637cbSDimitry Andric long long llrintl(long double x);
219*700637cbSDimitry Andric
220*700637cbSDimitry Andric long long llround (arithmetic x);
221*700637cbSDimitry Andric long long llroundf(float x);
222*700637cbSDimitry Andric long long llroundl(long double x);
223*700637cbSDimitry Andric
224*700637cbSDimitry Andric floating_point log1p (arithmetic x);
225*700637cbSDimitry Andric float log1pf(float x);
226*700637cbSDimitry Andric long double log1pl(long double x);
227*700637cbSDimitry Andric
228*700637cbSDimitry Andric floating_point log2 (arithmetic x);
229*700637cbSDimitry Andric float log2f(float x);
230*700637cbSDimitry Andric long double log2l(long double x);
231*700637cbSDimitry Andric
232*700637cbSDimitry Andric floating_point logb (arithmetic x);
233*700637cbSDimitry Andric float logbf(float x);
234*700637cbSDimitry Andric long double logbl(long double x);
235*700637cbSDimitry Andric
236*700637cbSDimitry Andric long lrint (arithmetic x);
237*700637cbSDimitry Andric long lrintf(float x);
238*700637cbSDimitry Andric long lrintl(long double x);
239*700637cbSDimitry Andric
240*700637cbSDimitry Andric long lround (arithmetic x);
241*700637cbSDimitry Andric long lroundf(float x);
242*700637cbSDimitry Andric long lroundl(long double x);
243*700637cbSDimitry Andric
244*700637cbSDimitry Andric double nan (const char* str);
245*700637cbSDimitry Andric float nanf(const char* str);
246*700637cbSDimitry Andric long double nanl(const char* str);
247*700637cbSDimitry Andric
248*700637cbSDimitry Andric floating_point nearbyint (arithmetic x);
249*700637cbSDimitry Andric float nearbyintf(float x);
250*700637cbSDimitry Andric long double nearbyintl(long double x);
251*700637cbSDimitry Andric
252*700637cbSDimitry Andric floating_point nextafter (arithmetic x, arithmetic y);
253*700637cbSDimitry Andric float nextafterf(float x, float y);
254*700637cbSDimitry Andric long double nextafterl(long double x, long double y);
255*700637cbSDimitry Andric
256*700637cbSDimitry Andric floating_point nexttoward (arithmetic x, long double y);
257*700637cbSDimitry Andric float nexttowardf(float x, long double y);
258*700637cbSDimitry Andric long double nexttowardl(long double x, long double y);
259*700637cbSDimitry Andric
260*700637cbSDimitry Andric floating_point remainder (arithmetic x, arithmetic y);
261*700637cbSDimitry Andric float remainderf(float x, float y);
262*700637cbSDimitry Andric long double remainderl(long double x, long double y);
263*700637cbSDimitry Andric
264*700637cbSDimitry Andric floating_point remquo (arithmetic x, arithmetic y, int* pquo);
265*700637cbSDimitry Andric float remquof(float x, float y, int* pquo);
266*700637cbSDimitry Andric long double remquol(long double x, long double y, int* pquo);
267*700637cbSDimitry Andric
268*700637cbSDimitry Andric floating_point rint (arithmetic x);
269*700637cbSDimitry Andric float rintf(float x);
270*700637cbSDimitry Andric long double rintl(long double x);
271*700637cbSDimitry Andric
272*700637cbSDimitry Andric floating_point round (arithmetic x);
273*700637cbSDimitry Andric float roundf(float x);
274*700637cbSDimitry Andric long double roundl(long double x);
275*700637cbSDimitry Andric
276*700637cbSDimitry Andric floating_point scalbln (arithmetic x, long ex);
277*700637cbSDimitry Andric float scalblnf(float x, long ex);
278*700637cbSDimitry Andric long double scalblnl(long double x, long ex);
279*700637cbSDimitry Andric
280*700637cbSDimitry Andric floating_point scalbn (arithmetic x, int ex);
281*700637cbSDimitry Andric float scalbnf(float x, int ex);
282*700637cbSDimitry Andric long double scalbnl(long double x, int ex);
283*700637cbSDimitry Andric
284*700637cbSDimitry Andric floating_point tgamma (arithmetic x);
285*700637cbSDimitry Andric float tgammaf(float x);
286*700637cbSDimitry Andric long double tgammal(long double x);
287*700637cbSDimitry Andric
288*700637cbSDimitry Andric floating_point trunc (arithmetic x);
289*700637cbSDimitry Andric float truncf(float x);
290*700637cbSDimitry Andric long double truncl(long double x);
291*700637cbSDimitry Andric
292*700637cbSDimitry Andric */
293*700637cbSDimitry Andric
294*700637cbSDimitry Andric # include <__cxx03/__config>
295*700637cbSDimitry Andric
296*700637cbSDimitry Andric # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
297*700637cbSDimitry Andric # pragma GCC system_header
298*700637cbSDimitry Andric # endif
299*700637cbSDimitry Andric
300*700637cbSDimitry Andric # if __has_include_next(<math.h>)
301*700637cbSDimitry Andric # include_next <math.h>
302*700637cbSDimitry Andric # endif
303*700637cbSDimitry Andric
304*700637cbSDimitry Andric # ifdef __cplusplus
305*700637cbSDimitry Andric
306*700637cbSDimitry Andric // We support including .h headers inside 'extern "C"' contexts, so switch
307*700637cbSDimitry Andric // back to C++ linkage before including these C++ headers.
308*700637cbSDimitry Andric extern "C++" {
309*700637cbSDimitry Andric
310*700637cbSDimitry Andric # ifdef fpclassify
311*700637cbSDimitry Andric # undef fpclassify
312*700637cbSDimitry Andric # endif
313*700637cbSDimitry Andric
314*700637cbSDimitry Andric # ifdef signbit
315*700637cbSDimitry Andric # undef signbit
316*700637cbSDimitry Andric # endif
317*700637cbSDimitry Andric
318*700637cbSDimitry Andric # ifdef isfinite
319*700637cbSDimitry Andric # undef isfinite
320*700637cbSDimitry Andric # endif
321*700637cbSDimitry Andric
322*700637cbSDimitry Andric # ifdef isinf
323*700637cbSDimitry Andric # undef isinf
324*700637cbSDimitry Andric # endif
325*700637cbSDimitry Andric
326*700637cbSDimitry Andric # ifdef isnan
327*700637cbSDimitry Andric # undef isnan
328*700637cbSDimitry Andric # endif
329*700637cbSDimitry Andric
330*700637cbSDimitry Andric # ifdef isnormal
331*700637cbSDimitry Andric # undef isnormal
332*700637cbSDimitry Andric # endif
333*700637cbSDimitry Andric
334*700637cbSDimitry Andric # ifdef isgreater
335*700637cbSDimitry Andric # undef isgreater
336*700637cbSDimitry Andric # endif
337*700637cbSDimitry Andric
338*700637cbSDimitry Andric # ifdef isgreaterequal
339*700637cbSDimitry Andric # undef isgreaterequal
340*700637cbSDimitry Andric # endif
341*700637cbSDimitry Andric
342*700637cbSDimitry Andric # ifdef isless
343*700637cbSDimitry Andric # undef isless
344*700637cbSDimitry Andric # endif
345*700637cbSDimitry Andric
346*700637cbSDimitry Andric # ifdef islessequal
347*700637cbSDimitry Andric # undef islessequal
348*700637cbSDimitry Andric # endif
349*700637cbSDimitry Andric
350*700637cbSDimitry Andric # ifdef islessgreater
351*700637cbSDimitry Andric # undef islessgreater
352*700637cbSDimitry Andric # endif
353*700637cbSDimitry Andric
354*700637cbSDimitry Andric # ifdef isunordered
355*700637cbSDimitry Andric # undef isunordered
356*700637cbSDimitry Andric # endif
357*700637cbSDimitry Andric
358*700637cbSDimitry Andric # include <__cxx03/__math/abs.h>
359*700637cbSDimitry Andric # include <__cxx03/__math/copysign.h>
360*700637cbSDimitry Andric # include <__cxx03/__math/error_functions.h>
361*700637cbSDimitry Andric # include <__cxx03/__math/exponential_functions.h>
362*700637cbSDimitry Andric # include <__cxx03/__math/fdim.h>
363*700637cbSDimitry Andric # include <__cxx03/__math/fma.h>
364*700637cbSDimitry Andric # include <__cxx03/__math/gamma.h>
365*700637cbSDimitry Andric # include <__cxx03/__math/hyperbolic_functions.h>
366*700637cbSDimitry Andric # include <__cxx03/__math/hypot.h>
367*700637cbSDimitry Andric # include <__cxx03/__math/inverse_hyperbolic_functions.h>
368*700637cbSDimitry Andric # include <__cxx03/__math/inverse_trigonometric_functions.h>
369*700637cbSDimitry Andric # include <__cxx03/__math/logarithms.h>
370*700637cbSDimitry Andric # include <__cxx03/__math/min_max.h>
371*700637cbSDimitry Andric # include <__cxx03/__math/modulo.h>
372*700637cbSDimitry Andric # include <__cxx03/__math/remainder.h>
373*700637cbSDimitry Andric # include <__cxx03/__math/roots.h>
374*700637cbSDimitry Andric # include <__cxx03/__math/rounding_functions.h>
375*700637cbSDimitry Andric # include <__cxx03/__math/traits.h>
376*700637cbSDimitry Andric # include <__cxx03/__math/trigonometric_functions.h>
377*700637cbSDimitry Andric # include <__cxx03/__type_traits/enable_if.h>
378*700637cbSDimitry Andric # include <__cxx03/__type_traits/is_floating_point.h>
379*700637cbSDimitry Andric # include <__cxx03/__type_traits/is_integral.h>
380*700637cbSDimitry Andric # include <__cxx03/stdlib.h>
381*700637cbSDimitry Andric
382*700637cbSDimitry Andric // fpclassify relies on implementation-defined constants, so we can't move it to a detail header
383*700637cbSDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
384*700637cbSDimitry Andric
385*700637cbSDimitry Andric namespace __math {
386*700637cbSDimitry Andric
387*700637cbSDimitry Andric // fpclassify
388*700637cbSDimitry Andric
389*700637cbSDimitry Andric // template on non-double overloads to make them weaker than same overloads from MSVC runtime
390*700637cbSDimitry Andric template <class = int>
fpclassify(float __x)391*700637cbSDimitry Andric _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(float __x) _NOEXCEPT {
392*700637cbSDimitry Andric return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
393*700637cbSDimitry Andric }
394*700637cbSDimitry Andric
395*700637cbSDimitry Andric template <class = int>
fpclassify(double __x)396*700637cbSDimitry Andric _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(double __x) _NOEXCEPT {
397*700637cbSDimitry Andric return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
398*700637cbSDimitry Andric }
399*700637cbSDimitry Andric
400*700637cbSDimitry Andric template <class = int>
fpclassify(long double __x)401*700637cbSDimitry Andric _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(long double __x) _NOEXCEPT {
402*700637cbSDimitry Andric return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x);
403*700637cbSDimitry Andric }
404*700637cbSDimitry Andric
405*700637cbSDimitry Andric template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0>
fpclassify(_A1 __x)406*700637cbSDimitry Andric _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT {
407*700637cbSDimitry Andric return __x == 0 ? FP_ZERO : FP_NORMAL;
408*700637cbSDimitry Andric }
409*700637cbSDimitry Andric
410*700637cbSDimitry Andric } // namespace __math
411*700637cbSDimitry Andric
412*700637cbSDimitry Andric _LIBCPP_END_NAMESPACE_STD
413*700637cbSDimitry Andric
414*700637cbSDimitry Andric using std::__math::fpclassify;
415*700637cbSDimitry Andric using std::__math::signbit;
416*700637cbSDimitry Andric
417*700637cbSDimitry Andric // The MSVC runtime already provides these functions as templates
418*700637cbSDimitry Andric # ifndef _LIBCPP_MSVCRT
419*700637cbSDimitry Andric using std::__math::isfinite;
420*700637cbSDimitry Andric using std::__math::isgreater;
421*700637cbSDimitry Andric using std::__math::isgreaterequal;
422*700637cbSDimitry Andric using std::__math::isinf;
423*700637cbSDimitry Andric using std::__math::isless;
424*700637cbSDimitry Andric using std::__math::islessequal;
425*700637cbSDimitry Andric using std::__math::islessgreater;
426*700637cbSDimitry Andric using std::__math::isnan;
427*700637cbSDimitry Andric using std::__math::isnormal;
428*700637cbSDimitry Andric using std::__math::isunordered;
429*700637cbSDimitry Andric # endif // _LIBCPP_MSVCRT
430*700637cbSDimitry Andric
431*700637cbSDimitry Andric // abs
432*700637cbSDimitry Andric //
433*700637cbSDimitry Andric // handled in stdlib.h
434*700637cbSDimitry Andric
435*700637cbSDimitry Andric // div
436*700637cbSDimitry Andric //
437*700637cbSDimitry Andric // handled in stdlib.h
438*700637cbSDimitry Andric
439*700637cbSDimitry Andric // We have to provide double overloads for <math.h> to work on platforms that don't provide the full set of math
440*700637cbSDimitry Andric // functions. To make the overload set work with multiple functions that take the same arguments, we make our overloads
441*700637cbSDimitry Andric // templates. Functions are preferred over function templates during overload resolution, which means that our overload
442*700637cbSDimitry Andric // will only be selected when the C library doesn't provide one.
443*700637cbSDimitry Andric
444*700637cbSDimitry Andric using std::__math::acos;
445*700637cbSDimitry Andric using std::__math::acosh;
446*700637cbSDimitry Andric using std::__math::asin;
447*700637cbSDimitry Andric using std::__math::asinh;
448*700637cbSDimitry Andric using std::__math::atan;
449*700637cbSDimitry Andric using std::__math::atan2;
450*700637cbSDimitry Andric using std::__math::atanh;
451*700637cbSDimitry Andric using std::__math::cbrt;
452*700637cbSDimitry Andric using std::__math::ceil;
453*700637cbSDimitry Andric using std::__math::copysign;
454*700637cbSDimitry Andric using std::__math::cos;
455*700637cbSDimitry Andric using std::__math::cosh;
456*700637cbSDimitry Andric using std::__math::erf;
457*700637cbSDimitry Andric using std::__math::erfc;
458*700637cbSDimitry Andric using std::__math::exp;
459*700637cbSDimitry Andric using std::__math::exp2;
460*700637cbSDimitry Andric using std::__math::expm1;
461*700637cbSDimitry Andric using std::__math::fabs;
462*700637cbSDimitry Andric using std::__math::fdim;
463*700637cbSDimitry Andric using std::__math::floor;
464*700637cbSDimitry Andric using std::__math::fma;
465*700637cbSDimitry Andric using std::__math::fmax;
466*700637cbSDimitry Andric using std::__math::fmin;
467*700637cbSDimitry Andric using std::__math::fmod;
468*700637cbSDimitry Andric using std::__math::frexp;
469*700637cbSDimitry Andric using std::__math::hypot;
470*700637cbSDimitry Andric using std::__math::ilogb;
471*700637cbSDimitry Andric using std::__math::ldexp;
472*700637cbSDimitry Andric using std::__math::lgamma;
473*700637cbSDimitry Andric using std::__math::llrint;
474*700637cbSDimitry Andric using std::__math::llround;
475*700637cbSDimitry Andric using std::__math::log;
476*700637cbSDimitry Andric using std::__math::log10;
477*700637cbSDimitry Andric using std::__math::log1p;
478*700637cbSDimitry Andric using std::__math::log2;
479*700637cbSDimitry Andric using std::__math::logb;
480*700637cbSDimitry Andric using std::__math::lrint;
481*700637cbSDimitry Andric using std::__math::lround;
482*700637cbSDimitry Andric using std::__math::modf;
483*700637cbSDimitry Andric using std::__math::nearbyint;
484*700637cbSDimitry Andric using std::__math::nextafter;
485*700637cbSDimitry Andric using std::__math::nexttoward;
486*700637cbSDimitry Andric using std::__math::pow;
487*700637cbSDimitry Andric using std::__math::remainder;
488*700637cbSDimitry Andric using std::__math::remquo;
489*700637cbSDimitry Andric using std::__math::rint;
490*700637cbSDimitry Andric using std::__math::round;
491*700637cbSDimitry Andric using std::__math::scalbln;
492*700637cbSDimitry Andric using std::__math::scalbn;
493*700637cbSDimitry Andric using std::__math::signbit;
494*700637cbSDimitry Andric using std::__math::sin;
495*700637cbSDimitry Andric using std::__math::sinh;
496*700637cbSDimitry Andric using std::__math::sqrt;
497*700637cbSDimitry Andric using std::__math::tan;
498*700637cbSDimitry Andric using std::__math::tanh;
499*700637cbSDimitry Andric using std::__math::tgamma;
500*700637cbSDimitry Andric using std::__math::trunc;
501*700637cbSDimitry Andric
502*700637cbSDimitry Andric } // extern "C++"
503*700637cbSDimitry Andric
504*700637cbSDimitry Andric # endif // __cplusplus
505*700637cbSDimitry Andric
506*700637cbSDimitry Andric #else // _LIBCPP___CXX03_MATH_H
507*700637cbSDimitry Andric
508*700637cbSDimitry Andric // This include lives outside the header guard in order to support an MSVC
509*700637cbSDimitry Andric // extension which allows users to do:
510*700637cbSDimitry Andric //
511*700637cbSDimitry Andric // #define _USE_MATH_DEFINES
512*700637cbSDimitry Andric // #include <__cxx03/math.h>
513*700637cbSDimitry Andric //
514*700637cbSDimitry Andric // and receive the definitions of mathematical constants, even if <math.h>
515*700637cbSDimitry Andric // has previously been included.
516*700637cbSDimitry Andric # if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
517*700637cbSDimitry Andric # include_next <math.h>
518*700637cbSDimitry Andric # endif
519*700637cbSDimitry Andric
520*700637cbSDimitry Andric #endif // _LIBCPP___CXX03_MATH_H
521