2 //===---------------------------- cmath -----------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
36 math_errhandling // C99
48 floating_point abs(floating_point x);
50 floating_point acos (arithmetic x);
52 long double acosl(long double x);
54 floating_point asin (arithmetic x);
56 long double asinl(long double x);
58 floating_point atan (arithmetic x);
60 long double atanl(long double x);
62 floating_point atan2 (arithmetic y, arithmetic x);
63 float atan2f(float y, float x);
64 long double atan2l(long double y, long double x);
66 floating_point ceil (arithmetic x);
68 long double ceill(long double x);
70 floating_point cos (arithmetic x);
72 long double cosl(long double x);
74 floating_point cosh (arithmetic x);
76 long double coshl(long double x);
78 floating_point exp (arithmetic x);
80 long double expl(long double x);
82 floating_point fabs (arithmetic x);
84 long double fabsl(long double x);
86 floating_point floor (arithmetic x);
87 float floorf(float x);
88 long double floorl(long double x);
90 floating_point fmod (arithmetic x, arithmetic y);
91 float fmodf(float x, float y);
92 long double fmodl(long double x, long double y);
94 floating_point frexp (arithmetic value, int* exp);
95 float frexpf(float value, int* exp);
96 long double frexpl(long double value, int* exp);
98 floating_point ldexp (arithmetic value, int exp);
99 float ldexpf(float value, int exp);
100 long double ldexpl(long double value, int exp);
102 floating_point log (arithmetic x);
104 long double logl(long double x);
106 floating_point log10 (arithmetic x);
107 float log10f(float x);
108 long double log10l(long double x);
110 floating_point modf (floating_point value, floating_point* iptr);
111 float modff(float value, float* iptr);
112 long double modfl(long double value, long double* iptr);
114 floating_point pow (arithmetic x, arithmetic y);
115 float powf(float x, float y);
116 long double powl(long double x, long double y);
118 floating_point sin (arithmetic x);
120 long double sinl(long double x);
122 floating_point sinh (arithmetic x);
123 float sinhf(float x);
124 long double sinhl(long double x);
126 floating_point sqrt (arithmetic x);
127 float sqrtf(float x);
128 long double sqrtl(long double x);
130 floating_point tan (arithmetic x);
132 long double tanl(long double x);
134 floating_point tanh (arithmetic x);
135 float tanhf(float x);
136 long double tanhl(long double x);
140 bool signbit(arithmetic x);
142 int fpclassify(arithmetic x);
144 bool isfinite(arithmetic x);
145 bool isinf(arithmetic x);
146 bool isnan(arithmetic x);
147 bool isnormal(arithmetic x);
149 bool isgreater(arithmetic x, arithmetic y);
150 bool isgreaterequal(arithmetic x, arithmetic y);
151 bool isless(arithmetic x, arithmetic y);
152 bool islessequal(arithmetic x, arithmetic y);
153 bool islessgreater(arithmetic x, arithmetic y);
154 bool isunordered(arithmetic x, arithmetic y);
156 floating_point acosh (arithmetic x);
157 float acoshf(float x);
158 long double acoshl(long double x);
160 floating_point asinh (arithmetic x);
161 float asinhf(float x);
162 long double asinhl(long double x);
164 floating_point atanh (arithmetic x);
165 float atanhf(float x);
166 long double atanhl(long double x);
168 floating_point cbrt (arithmetic x);
169 float cbrtf(float x);
170 long double cbrtl(long double x);
172 floating_point copysign (arithmetic x, arithmetic y);
173 float copysignf(float x, float y);
174 long double copysignl(long double x, long double y);
176 floating_point erf (arithmetic x);
178 long double erfl(long double x);
180 floating_point erfc (arithmetic x);
181 float erfcf(float x);
182 long double erfcl(long double x);
184 floating_point exp2 (arithmetic x);
185 float exp2f(float x);
186 long double exp2l(long double x);
188 floating_point expm1 (arithmetic x);
189 float expm1f(float x);
190 long double expm1l(long double x);
192 floating_point fdim (arithmetic x, arithmetic y);
193 float fdimf(float x, float y);
194 long double fdiml(long double x, long double y);
196 floating_point fma (arithmetic x, arithmetic y, arithmetic z);
197 float fmaf(float x, float y, float z);
198 long double fmal(long double x, long double y, long double z);
200 floating_point fmax (arithmetic x, arithmetic y);
201 float fmaxf(float x, float y);
202 long double fmaxl(long double x, long double y);
204 floating_point fmin (arithmetic x, arithmetic y);
205 float fminf(float x, float y);
206 long double fminl(long double x, long double y);
208 floating_point hypot (arithmetic x, arithmetic y);
209 float hypotf(float x, float y);
210 long double hypotl(long double x, long double y);
212 double hypot(double x, double y, double z); // C++17
213 float hypot(float x, float y, float z); // C++17
214 long double hypot(long double x, long double y, long double z); // C++17
216 int ilogb (arithmetic x);
218 int ilogbl(long double x);
220 floating_point lgamma (arithmetic x);
221 float lgammaf(float x);
222 long double lgammal(long double x);
224 long long llrint (arithmetic x);
225 long long llrintf(float x);
226 long long llrintl(long double x);
228 long long llround (arithmetic x);
229 long long llroundf(float x);
230 long long llroundl(long double x);
232 floating_point log1p (arithmetic x);
233 float log1pf(float x);
234 long double log1pl(long double x);
236 floating_point log2 (arithmetic x);
237 float log2f(float x);
238 long double log2l(long double x);
240 floating_point logb (arithmetic x);
241 float logbf(float x);
242 long double logbl(long double x);
244 long lrint (arithmetic x);
245 long lrintf(float x);
246 long lrintl(long double x);
248 long lround (arithmetic x);
249 long lroundf(float x);
250 long lroundl(long double x);
252 double nan (const char* str);
253 float nanf(const char* str);
254 long double nanl(const char* str);
256 floating_point nearbyint (arithmetic x);
257 float nearbyintf(float x);
258 long double nearbyintl(long double x);
260 floating_point nextafter (arithmetic x, arithmetic y);
261 float nextafterf(float x, float y);
262 long double nextafterl(long double x, long double y);
264 floating_point nexttoward (arithmetic x, long double y);
265 float nexttowardf(float x, long double y);
266 long double nexttowardl(long double x, long double y);
268 floating_point remainder (arithmetic x, arithmetic y);
269 float remainderf(float x, float y);
270 long double remainderl(long double x, long double y);
272 floating_point remquo (arithmetic x, arithmetic y, int* pquo);
273 float remquof(float x, float y, int* pquo);
274 long double remquol(long double x, long double y, int* pquo);
276 floating_point rint (arithmetic x);
277 float rintf(float x);
278 long double rintl(long double x);
280 floating_point round (arithmetic x);
281 float roundf(float x);
282 long double roundl(long double x);
284 floating_point scalbln (arithmetic x, long ex);
285 float scalblnf(float x, long ex);
286 long double scalblnl(long double x, long ex);
288 floating_point scalbn (arithmetic x, int ex);
289 float scalbnf(float x, int ex);
290 long double scalbnl(long double x, int ex);
292 floating_point tgamma (arithmetic x);
293 float tgammaf(float x);
294 long double tgammal(long double x);
296 floating_point trunc (arithmetic x);
297 float truncf(float x);
298 long double truncl(long double x);
307 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
308 #pragma GCC system_header
311 _LIBCPP_BEGIN_NAMESPACE_STD
320 using ::isgreaterequal;
323 using ::islessgreater;
401 #ifndef _LIBCPP_MSVCRT
438 #endif // _LIBCPP_MSVCRT
443 #ifndef _LIBCPP_MSVCRT
466 #endif // !_LIBCPP_MSVCRT
498 #ifndef _LIBCPP_MSVCRT
529 #endif // !_LIBCPP_MSVCRT
531 #if _LIBCPP_STD_VER > 14
532 inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); }
533 inline _LIBCPP_INLINE_VISIBILITY double hypot( double x, double y, double z ) { return sqrt(x*x + y*y + z*z); }
534 inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double x, long double y, long double z ) { return sqrt(x*x + y*y + z*z); }
536 template <class _A1, class _A2, class _A3>
537 inline _LIBCPP_INLINE_VISIBILITY
538 typename __lazy_enable_if
540 is_arithmetic<_A1>::value &&
541 is_arithmetic<_A2>::value &&
542 is_arithmetic<_A3>::value,
543 __promote<_A1, _A2, _A3>
545 hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
547 typedef typename __promote<_A1, _A2, _A3>::type __result_type;
548 static_assert((!(is_same<_A1, __result_type>::value &&
549 is_same<_A2, __result_type>::value &&
550 is_same<_A3, __result_type>::value)), "");
551 return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
556 _LIBCPP_ALWAYS_INLINE
557 _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
558 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
560 #if __has_builtin(__builtin_isnan)
561 return __builtin_isnan(__lcpp_x);
563 return isnan(__lcpp_x);
568 _LIBCPP_ALWAYS_INLINE
569 _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
570 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
572 return isnan(__lcpp_x);
576 _LIBCPP_ALWAYS_INLINE
577 _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
578 __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
580 #if __has_builtin(__builtin_isinf)
581 return __builtin_isinf(__lcpp_x);
583 return isinf(__lcpp_x);
588 _LIBCPP_ALWAYS_INLINE
589 _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
590 __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
592 return isinf(__lcpp_x);
596 _LIBCPP_ALWAYS_INLINE
597 _LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
598 __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
600 #if __has_builtin(__builtin_isfinite)
601 return __builtin_isfinite(__lcpp_x);
603 return isfinite(__lcpp_x);
608 _LIBCPP_ALWAYS_INLINE
609 _LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
610 __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
612 return isfinite(__lcpp_x);
615 _LIBCPP_END_NAMESPACE_STD
617 #endif // _LIBCPP_CMATH