blob: b7659267e7e18791528f57a88f43b3cb55d689ac [file] [log] [blame]
Richard Smith4faa3942015-10-08 20:40:34 +00001// -*- C++ -*-
2//===---------------------------- math.h ----------------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_MATH_H
12#define _LIBCPP_MATH_H
13
14/*
15 math.h synopsis
16
17Macros:
18
19 HUGE_VAL
20 HUGE_VALF // C99
21 HUGE_VALL // C99
22 INFINITY // C99
23 NAN // C99
24 FP_INFINITE // C99
25 FP_NAN // C99
26 FP_NORMAL // C99
27 FP_SUBNORMAL // C99
28 FP_ZERO // C99
29 FP_FAST_FMA // C99
30 FP_FAST_FMAF // C99
31 FP_FAST_FMAL // C99
32 FP_ILOGB0 // C99
33 FP_ILOGBNAN // C99
34 MATH_ERRNO // C99
35 MATH_ERREXCEPT // C99
36 math_errhandling // C99
37
38Types:
39
40 float_t // C99
41 double_t // C99
42
43// C90
44
45floating_point abs(floating_point x);
46
47floating_point acos (arithmetic x);
48float acosf(float x);
49long double acosl(long double x);
50
51floating_point asin (arithmetic x);
52float asinf(float x);
53long double asinl(long double x);
54
55floating_point atan (arithmetic x);
56float atanf(float x);
57long double atanl(long double x);
58
59floating_point atan2 (arithmetic y, arithmetic x);
60float atan2f(float y, float x);
61long double atan2l(long double y, long double x);
62
63floating_point ceil (arithmetic x);
64float ceilf(float x);
65long double ceill(long double x);
66
67floating_point cos (arithmetic x);
68float cosf(float x);
69long double cosl(long double x);
70
71floating_point cosh (arithmetic x);
72float coshf(float x);
73long double coshl(long double x);
74
75floating_point exp (arithmetic x);
76float expf(float x);
77long double expl(long double x);
78
79floating_point fabs (arithmetic x);
80float fabsf(float x);
81long double fabsl(long double x);
82
83floating_point floor (arithmetic x);
84float floorf(float x);
85long double floorl(long double x);
86
87floating_point fmod (arithmetic x, arithmetic y);
88float fmodf(float x, float y);
89long double fmodl(long double x, long double y);
90
91floating_point frexp (arithmetic value, int* exp);
92float frexpf(float value, int* exp);
93long double frexpl(long double value, int* exp);
94
95floating_point ldexp (arithmetic value, int exp);
96float ldexpf(float value, int exp);
97long double ldexpl(long double value, int exp);
98
99floating_point log (arithmetic x);
100float logf(float x);
101long double logl(long double x);
102
103floating_point log10 (arithmetic x);
104float log10f(float x);
105long double log10l(long double x);
106
107floating_point modf (floating_point value, floating_point* iptr);
108float modff(float value, float* iptr);
109long double modfl(long double value, long double* iptr);
110
111floating_point pow (arithmetic x, arithmetic y);
112float powf(float x, float y);
113long double powl(long double x, long double y);
114
115floating_point sin (arithmetic x);
116float sinf(float x);
117long double sinl(long double x);
118
119floating_point sinh (arithmetic x);
120float sinhf(float x);
121long double sinhl(long double x);
122
123floating_point sqrt (arithmetic x);
124float sqrtf(float x);
125long double sqrtl(long double x);
126
127floating_point tan (arithmetic x);
128float tanf(float x);
129long double tanl(long double x);
130
131floating_point tanh (arithmetic x);
132float tanhf(float x);
133long double tanhl(long double x);
134
135// C99
136
137bool signbit(arithmetic x);
138
139int fpclassify(arithmetic x);
140
141bool isfinite(arithmetic x);
142bool isinf(arithmetic x);
143bool isnan(arithmetic x);
144bool isnormal(arithmetic x);
145
146bool isgreater(arithmetic x, arithmetic y);
147bool isgreaterequal(arithmetic x, arithmetic y);
148bool isless(arithmetic x, arithmetic y);
149bool islessequal(arithmetic x, arithmetic y);
150bool islessgreater(arithmetic x, arithmetic y);
151bool isunordered(arithmetic x, arithmetic y);
152
153floating_point acosh (arithmetic x);
154float acoshf(float x);
155long double acoshl(long double x);
156
157floating_point asinh (arithmetic x);
158float asinhf(float x);
159long double asinhl(long double x);
160
161floating_point atanh (arithmetic x);
162float atanhf(float x);
163long double atanhl(long double x);
164
165floating_point cbrt (arithmetic x);
166float cbrtf(float x);
167long double cbrtl(long double x);
168
169floating_point copysign (arithmetic x, arithmetic y);
170float copysignf(float x, float y);
171long double copysignl(long double x, long double y);
172
173floating_point erf (arithmetic x);
174float erff(float x);
175long double erfl(long double x);
176
177floating_point erfc (arithmetic x);
178float erfcf(float x);
179long double erfcl(long double x);
180
181floating_point exp2 (arithmetic x);
182float exp2f(float x);
183long double exp2l(long double x);
184
185floating_point expm1 (arithmetic x);
186float expm1f(float x);
187long double expm1l(long double x);
188
189floating_point fdim (arithmetic x, arithmetic y);
190float fdimf(float x, float y);
191long double fdiml(long double x, long double y);
192
193floating_point fma (arithmetic x, arithmetic y, arithmetic z);
194float fmaf(float x, float y, float z);
195long double fmal(long double x, long double y, long double z);
196
197floating_point fmax (arithmetic x, arithmetic y);
198float fmaxf(float x, float y);
199long double fmaxl(long double x, long double y);
200
201floating_point fmin (arithmetic x, arithmetic y);
202float fminf(float x, float y);
203long double fminl(long double x, long double y);
204
205floating_point hypot (arithmetic x, arithmetic y);
206float hypotf(float x, float y);
207long double hypotl(long double x, long double y);
208
209int ilogb (arithmetic x);
210int ilogbf(float x);
211int ilogbl(long double x);
212
213floating_point lgamma (arithmetic x);
214float lgammaf(float x);
215long double lgammal(long double x);
216
217long long llrint (arithmetic x);
218long long llrintf(float x);
219long long llrintl(long double x);
220
221long long llround (arithmetic x);
222long long llroundf(float x);
223long long llroundl(long double x);
224
225floating_point log1p (arithmetic x);
226float log1pf(float x);
227long double log1pl(long double x);
228
229floating_point log2 (arithmetic x);
230float log2f(float x);
231long double log2l(long double x);
232
233floating_point logb (arithmetic x);
234float logbf(float x);
235long double logbl(long double x);
236
237long lrint (arithmetic x);
238long lrintf(float x);
239long lrintl(long double x);
240
241long lround (arithmetic x);
242long lroundf(float x);
243long lroundl(long double x);
244
245double nan (const char* str);
246float nanf(const char* str);
247long double nanl(const char* str);
248
249floating_point nearbyint (arithmetic x);
250float nearbyintf(float x);
251long double nearbyintl(long double x);
252
253floating_point nextafter (arithmetic x, arithmetic y);
254float nextafterf(float x, float y);
255long double nextafterl(long double x, long double y);
256
257floating_point nexttoward (arithmetic x, long double y);
258float nexttowardf(float x, long double y);
259long double nexttowardl(long double x, long double y);
260
261floating_point remainder (arithmetic x, arithmetic y);
262float remainderf(float x, float y);
263long double remainderl(long double x, long double y);
264
265floating_point remquo (arithmetic x, arithmetic y, int* pquo);
266float remquof(float x, float y, int* pquo);
267long double remquol(long double x, long double y, int* pquo);
268
269floating_point rint (arithmetic x);
270float rintf(float x);
271long double rintl(long double x);
272
273floating_point round (arithmetic x);
274float roundf(float x);
275long double roundl(long double x);
276
277floating_point scalbln (arithmetic x, long ex);
278float scalblnf(float x, long ex);
279long double scalblnl(long double x, long ex);
280
281floating_point scalbn (arithmetic x, int ex);
282float scalbnf(float x, int ex);
283long double scalbnl(long double x, int ex);
284
285floating_point tgamma (arithmetic x);
286float tgammaf(float x);
287long double tgammal(long double x);
288
289floating_point trunc (arithmetic x);
290float truncf(float x);
291long double truncl(long double x);
292
293*/
294
295#include <__config>
Saleem Abdulrasool766ba682017-02-13 15:26:50 +0000296#if defined(_LIBCPP_MSVCRT)
297#include <crtversion.h>
298#endif
Richard Smith4faa3942015-10-08 20:40:34 +0000299
300#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
301#pragma GCC system_header
302#endif
303
Richard Smith45bae0b2015-10-09 00:26:50 +0000304#include_next <math.h>
305
Richard Smith4faa3942015-10-08 20:40:34 +0000306#ifdef __cplusplus
307
308// We support including .h headers inside 'extern "C"' contexts, so switch
309// back to C++ linkage before including these C++ headers.
310extern "C++" {
311
312#include <type_traits>
313
Richard Smith4faa3942015-10-08 20:40:34 +0000314// signbit
315
316#ifdef signbit
317
318template <class _A1>
319_LIBCPP_ALWAYS_INLINE
320bool
321__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
322{
323 return signbit(__lcpp_x);
324}
325
326#undef signbit
327
328template <class _A1>
329inline _LIBCPP_INLINE_VISIBILITY
330typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
331signbit(_A1 __lcpp_x) _NOEXCEPT
332{
333 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
334}
335
Saleem Abdulrasool1eab1682017-02-18 19:28:38 +0000336#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14)
337
338template <typename _A1>
339inline _LIBCPP_INLINE_VISIBILITY
340typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
341signbit(_A1 __lcpp_x) _NOEXCEPT
342{
343 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
344}
345
Richard Smith4faa3942015-10-08 20:40:34 +0000346#endif // signbit
347
348// fpclassify
349
350#ifdef fpclassify
351
352template <class _A1>
353_LIBCPP_ALWAYS_INLINE
354int
355__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
356{
357 return fpclassify(__lcpp_x);
358}
359
360#undef fpclassify
361
362template <class _A1>
363inline _LIBCPP_INLINE_VISIBILITY
364typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
365fpclassify(_A1 __lcpp_x) _NOEXCEPT
366{
367 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
368}
369
Saleem Abdulrasool1eab1682017-02-18 19:28:38 +0000370#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14)
371
372template <typename _A1>
373inline _LIBCPP_INLINE_VISIBILITY
374typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
375fpclassify(_A1 __lcpp_x) _NOEXCEPT
376{
377 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
378}
379
Richard Smith4faa3942015-10-08 20:40:34 +0000380#endif // fpclassify
381
382// isfinite
383
384#ifdef isfinite
385
386template <class _A1>
387_LIBCPP_ALWAYS_INLINE
388bool
389__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
390{
391 return isfinite(__lcpp_x);
392}
393
394#undef isfinite
395
396template <class _A1>
397inline _LIBCPP_INLINE_VISIBILITY
398typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
399isfinite(_A1 __lcpp_x) _NOEXCEPT
400{
401 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
402}
403
404#endif // isfinite
405
406// isinf
407
408#ifdef isinf
409
410template <class _A1>
411_LIBCPP_ALWAYS_INLINE
412bool
413__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
414{
415 return isinf(__lcpp_x);
416}
417
418#undef isinf
419
420template <class _A1>
421inline _LIBCPP_INLINE_VISIBILITY
422typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
423isinf(_A1 __lcpp_x) _NOEXCEPT
424{
425 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
426}
427
428#endif // isinf
429
430// isnan
431
432#ifdef isnan
433
434template <class _A1>
435_LIBCPP_ALWAYS_INLINE
436bool
437__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
438{
439 return isnan(__lcpp_x);
440}
441
442#undef isnan
443
444template <class _A1>
445inline _LIBCPP_INLINE_VISIBILITY
446typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
447isnan(_A1 __lcpp_x) _NOEXCEPT
448{
449 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
450}
451
452#endif // isnan
453
454// isnormal
455
456#ifdef isnormal
457
458template <class _A1>
459_LIBCPP_ALWAYS_INLINE
460bool
461__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
462{
463 return isnormal(__lcpp_x);
464}
465
466#undef isnormal
467
468template <class _A1>
469inline _LIBCPP_INLINE_VISIBILITY
470typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
471isnormal(_A1 __lcpp_x) _NOEXCEPT
472{
473 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
474}
475
476#endif // isnormal
477
478// isgreater
479
480#ifdef isgreater
481
482template <class _A1, class _A2>
483_LIBCPP_ALWAYS_INLINE
484bool
485__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
486{
487 return isgreater(__lcpp_x, __lcpp_y);
488}
489
490#undef isgreater
491
492template <class _A1, class _A2>
493inline _LIBCPP_INLINE_VISIBILITY
494typename std::enable_if
495<
496 std::is_arithmetic<_A1>::value &&
497 std::is_arithmetic<_A2>::value,
498 bool
499>::type
500isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
501{
502 typedef typename std::__promote<_A1, _A2>::type type;
503 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
504}
505
506#endif // isgreater
507
508// isgreaterequal
509
510#ifdef isgreaterequal
511
512template <class _A1, class _A2>
513_LIBCPP_ALWAYS_INLINE
514bool
515__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
516{
517 return isgreaterequal(__lcpp_x, __lcpp_y);
518}
519
520#undef isgreaterequal
521
522template <class _A1, class _A2>
523inline _LIBCPP_INLINE_VISIBILITY
524typename std::enable_if
525<
526 std::is_arithmetic<_A1>::value &&
527 std::is_arithmetic<_A2>::value,
528 bool
529>::type
530isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
531{
532 typedef typename std::__promote<_A1, _A2>::type type;
533 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
534}
535
536#endif // isgreaterequal
537
538// isless
539
540#ifdef isless
541
542template <class _A1, class _A2>
543_LIBCPP_ALWAYS_INLINE
544bool
545__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
546{
547 return isless(__lcpp_x, __lcpp_y);
548}
549
550#undef isless
551
552template <class _A1, class _A2>
553inline _LIBCPP_INLINE_VISIBILITY
554typename std::enable_if
555<
556 std::is_arithmetic<_A1>::value &&
557 std::is_arithmetic<_A2>::value,
558 bool
559>::type
560isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
561{
562 typedef typename std::__promote<_A1, _A2>::type type;
563 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
564}
565
566#endif // isless
567
568// islessequal
569
570#ifdef islessequal
571
572template <class _A1, class _A2>
573_LIBCPP_ALWAYS_INLINE
574bool
575__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
576{
577 return islessequal(__lcpp_x, __lcpp_y);
578}
579
580#undef islessequal
581
582template <class _A1, class _A2>
583inline _LIBCPP_INLINE_VISIBILITY
584typename std::enable_if
585<
586 std::is_arithmetic<_A1>::value &&
587 std::is_arithmetic<_A2>::value,
588 bool
589>::type
590islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
591{
592 typedef typename std::__promote<_A1, _A2>::type type;
593 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
594}
595
596#endif // islessequal
597
598// islessgreater
599
600#ifdef islessgreater
601
602template <class _A1, class _A2>
603_LIBCPP_ALWAYS_INLINE
604bool
605__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
606{
607 return islessgreater(__lcpp_x, __lcpp_y);
608}
609
610#undef islessgreater
611
612template <class _A1, class _A2>
613inline _LIBCPP_INLINE_VISIBILITY
614typename std::enable_if
615<
616 std::is_arithmetic<_A1>::value &&
617 std::is_arithmetic<_A2>::value,
618 bool
619>::type
620islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
621{
622 typedef typename std::__promote<_A1, _A2>::type type;
623 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
624}
625
626#endif // islessgreater
627
628// isunordered
629
630#ifdef isunordered
631
632template <class _A1, class _A2>
633_LIBCPP_ALWAYS_INLINE
634bool
635__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
636{
637 return isunordered(__lcpp_x, __lcpp_y);
638}
639
640#undef isunordered
641
642template <class _A1, class _A2>
643inline _LIBCPP_INLINE_VISIBILITY
644typename std::enable_if
645<
646 std::is_arithmetic<_A1>::value &&
647 std::is_arithmetic<_A2>::value,
648 bool
649>::type
650isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
651{
652 typedef typename std::__promote<_A1, _A2>::type type;
653 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
654}
655
656#endif // isunordered
657
Richard Smith4faa3942015-10-08 20:40:34 +0000658// abs
659
Eric Fiselier543cf612016-08-15 18:58:57 +0000660#if !(defined(_AIX) || defined(__sun__))
Richard Smith4faa3942015-10-08 20:40:34 +0000661inline _LIBCPP_INLINE_VISIBILITY
662float
Mehdi Amini76661302017-02-10 02:44:23 +0000663abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000664
665inline _LIBCPP_INLINE_VISIBILITY
666double
Mehdi Amini76661302017-02-10 02:44:23 +0000667abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000668
669inline _LIBCPP_INLINE_VISIBILITY
670long double
Mehdi Amini76661302017-02-10 02:44:23 +0000671abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Eric Fiselier543cf612016-08-15 18:58:57 +0000672#endif // !(defined(_AIX) || defined(__sun__))
Richard Smith4faa3942015-10-08 20:40:34 +0000673
674// acos
675
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000676#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000677inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
678inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000679#endif
680
681template <class _A1>
682inline _LIBCPP_INLINE_VISIBILITY
683typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000684acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000685
686// asin
687
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000688#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000689inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
690inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000691#endif
692
693template <class _A1>
694inline _LIBCPP_INLINE_VISIBILITY
695typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000696asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000697
698// atan
699
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000700#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000701inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
702inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000703#endif
704
705template <class _A1>
706inline _LIBCPP_INLINE_VISIBILITY
707typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000708atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000709
710// atan2
711
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000712#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000713inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
714inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000715#endif
716
717template <class _A1, class _A2>
718inline _LIBCPP_INLINE_VISIBILITY
719typename std::__lazy_enable_if
720<
721 std::is_arithmetic<_A1>::value &&
722 std::is_arithmetic<_A2>::value,
723 std::__promote<_A1, _A2>
724>::type
725atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
726{
727 typedef typename std::__promote<_A1, _A2>::type __result_type;
728 static_assert((!(std::is_same<_A1, __result_type>::value &&
729 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +0000730 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith4faa3942015-10-08 20:40:34 +0000731}
732
733// ceil
734
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000735#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000736inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
737inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000738#endif
739
740template <class _A1>
741inline _LIBCPP_INLINE_VISIBILITY
742typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000743ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000744
745// cos
746
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000747#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000748inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
749inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000750#endif
751
752template <class _A1>
753inline _LIBCPP_INLINE_VISIBILITY
754typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000755cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000756
757// cosh
758
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000759#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000760inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
761inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000762#endif
763
764template <class _A1>
765inline _LIBCPP_INLINE_VISIBILITY
766typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000767cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000768
769// exp
770
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000771#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000772inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
773inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000774#endif
775
776template <class _A1>
777inline _LIBCPP_INLINE_VISIBILITY
778typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000779exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000780
781// fabs
782
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000783#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000784inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
785inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000786#endif
787
788template <class _A1>
789inline _LIBCPP_INLINE_VISIBILITY
790typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000791fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000792
793// floor
794
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000795#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000796inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
797inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000798#endif
799
800template <class _A1>
801inline _LIBCPP_INLINE_VISIBILITY
802typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000803floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000804
805// fmod
806
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000807#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000808inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
809inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +0000810#endif
811
812template <class _A1, class _A2>
813inline _LIBCPP_INLINE_VISIBILITY
814typename std::__lazy_enable_if
815<
816 std::is_arithmetic<_A1>::value &&
817 std::is_arithmetic<_A2>::value,
818 std::__promote<_A1, _A2>
819>::type
820fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
821{
822 typedef typename std::__promote<_A1, _A2>::type __result_type;
823 static_assert((!(std::is_same<_A1, __result_type>::value &&
824 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +0000825 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +0000826}
827
828// frexp
829
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000830#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000831inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
832inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000833#endif
834
835template <class _A1>
836inline _LIBCPP_INLINE_VISIBILITY
837typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000838frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000839
840// ldexp
841
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000842#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000843inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
844inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000845#endif
846
847template <class _A1>
848inline _LIBCPP_INLINE_VISIBILITY
849typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000850ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith4faa3942015-10-08 20:40:34 +0000851
852// log
853
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000854#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000855inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
856inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000857#endif
858
859template <class _A1>
860inline _LIBCPP_INLINE_VISIBILITY
861typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000862log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000863
864// log10
865
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000866#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000867inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
868inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000869#endif
870
871template <class _A1>
872inline _LIBCPP_INLINE_VISIBILITY
873typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000874log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000875
876// modf
877
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000878#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000879inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
880inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +0000881#endif
882
883// pow
884
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000885#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000886inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
887inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +0000888#endif
889
890template <class _A1, class _A2>
891inline _LIBCPP_INLINE_VISIBILITY
892typename std::__lazy_enable_if
893<
894 std::is_arithmetic<_A1>::value &&
895 std::is_arithmetic<_A2>::value,
896 std::__promote<_A1, _A2>
897>::type
898pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
899{
900 typedef typename std::__promote<_A1, _A2>::type __result_type;
901 static_assert((!(std::is_same<_A1, __result_type>::value &&
902 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +0000903 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +0000904}
905
906// sin
907
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000908#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000909inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
910inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000911#endif
912
913template <class _A1>
914inline _LIBCPP_INLINE_VISIBILITY
915typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000916sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000917
918// sinh
919
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000920#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000921inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
922inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000923#endif
924
925template <class _A1>
926inline _LIBCPP_INLINE_VISIBILITY
927typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000928sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000929
930// sqrt
931
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000932#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000933inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
934inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000935#endif
936
Richard Smith4faa3942015-10-08 20:40:34 +0000937template <class _A1>
938inline _LIBCPP_INLINE_VISIBILITY
939typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000940sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000941
942// tan
943
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000944#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000945inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
946inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000947#endif
948
949template <class _A1>
950inline _LIBCPP_INLINE_VISIBILITY
951typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000952tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000953
954// tanh
955
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000956#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Amini76661302017-02-10 02:44:23 +0000957inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
958inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000959#endif
960
961template <class _A1>
962inline _LIBCPP_INLINE_VISIBILITY
963typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000964tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000965
966// acosh
967
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000968#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Amini76661302017-02-10 02:44:23 +0000969inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
970inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000971
972template <class _A1>
973inline _LIBCPP_INLINE_VISIBILITY
974typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000975acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000976#endif
977
978// asinh
979
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000980#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Amini76661302017-02-10 02:44:23 +0000981inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
982inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000983
984template <class _A1>
985inline _LIBCPP_INLINE_VISIBILITY
986typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000987asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000988#endif
989
990// atanh
991
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +0000992#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Amini76661302017-02-10 02:44:23 +0000993inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
994inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +0000995
996template <class _A1>
997inline _LIBCPP_INLINE_VISIBILITY
998typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +0000999atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001000#endif
1001
1002// cbrt
1003
Saleem Abdulrasoolbacb35f2017-02-12 21:42:37 +00001004#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Amini76661302017-02-10 02:44:23 +00001005inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
1006inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001007
1008template <class _A1>
1009inline _LIBCPP_INLINE_VISIBILITY
1010typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001011cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001012#endif
1013
1014// copysign
1015
1016#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
1017inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
1018 float __lcpp_y) _NOEXCEPT {
Mehdi Amini76661302017-02-10 02:44:23 +00001019 return ::copysignf(__lcpp_x, __lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001020}
1021inline _LIBCPP_INLINE_VISIBILITY long double
1022copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Mehdi Amini76661302017-02-10 02:44:23 +00001023 return ::copysignl(__lcpp_x, __lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001024}
1025#endif
1026
1027template <class _A1, class _A2>
1028inline _LIBCPP_INLINE_VISIBILITY
1029typename std::__lazy_enable_if
1030<
1031 std::is_arithmetic<_A1>::value &&
1032 std::is_arithmetic<_A2>::value,
1033 std::__promote<_A1, _A2>
1034>::type
1035copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1036{
1037 typedef typename std::__promote<_A1, _A2>::type __result_type;
1038 static_assert((!(std::is_same<_A1, __result_type>::value &&
1039 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001040 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001041}
1042
Saleem Abdulrasool29a83002017-02-17 23:08:44 +00001043#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
Richard Smith4faa3942015-10-08 20:40:34 +00001044
1045// erf
1046
Mehdi Amini76661302017-02-10 02:44:23 +00001047inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1048inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001049
1050template <class _A1>
1051inline _LIBCPP_INLINE_VISIBILITY
1052typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001053erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001054
1055// erfc
1056
Mehdi Amini76661302017-02-10 02:44:23 +00001057inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1058inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001059
1060template <class _A1>
1061inline _LIBCPP_INLINE_VISIBILITY
1062typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001063erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001064
1065// exp2
1066
Mehdi Amini76661302017-02-10 02:44:23 +00001067inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1068inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001069
1070template <class _A1>
1071inline _LIBCPP_INLINE_VISIBILITY
1072typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001073exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001074
1075// expm1
1076
Mehdi Amini76661302017-02-10 02:44:23 +00001077inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1078inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001079
1080template <class _A1>
1081inline _LIBCPP_INLINE_VISIBILITY
1082typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001083expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001084
1085// fdim
1086
Mehdi Amini76661302017-02-10 02:44:23 +00001087inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1088inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001089
1090template <class _A1, class _A2>
1091inline _LIBCPP_INLINE_VISIBILITY
1092typename std::__lazy_enable_if
1093<
1094 std::is_arithmetic<_A1>::value &&
1095 std::is_arithmetic<_A2>::value,
1096 std::__promote<_A1, _A2>
1097>::type
1098fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1099{
1100 typedef typename std::__promote<_A1, _A2>::type __result_type;
1101 static_assert((!(std::is_same<_A1, __result_type>::value &&
1102 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001103 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001104}
1105
1106// fma
1107
Mehdi Amini76661302017-02-10 02:44:23 +00001108inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1109inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
Richard Smith4faa3942015-10-08 20:40:34 +00001110
1111template <class _A1, class _A2, class _A3>
1112inline _LIBCPP_INLINE_VISIBILITY
1113typename std::__lazy_enable_if
1114<
1115 std::is_arithmetic<_A1>::value &&
1116 std::is_arithmetic<_A2>::value &&
1117 std::is_arithmetic<_A3>::value,
1118 std::__promote<_A1, _A2, _A3>
1119>::type
1120fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1121{
1122 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1123 static_assert((!(std::is_same<_A1, __result_type>::value &&
1124 std::is_same<_A2, __result_type>::value &&
1125 std::is_same<_A3, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001126 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Richard Smith4faa3942015-10-08 20:40:34 +00001127}
1128
1129// fmax
1130
Mehdi Amini76661302017-02-10 02:44:23 +00001131inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1132inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001133
1134template <class _A1, class _A2>
1135inline _LIBCPP_INLINE_VISIBILITY
1136typename std::__lazy_enable_if
1137<
1138 std::is_arithmetic<_A1>::value &&
1139 std::is_arithmetic<_A2>::value,
1140 std::__promote<_A1, _A2>
1141>::type
1142fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1143{
1144 typedef typename std::__promote<_A1, _A2>::type __result_type;
1145 static_assert((!(std::is_same<_A1, __result_type>::value &&
1146 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001147 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001148}
1149
1150// fmin
1151
Mehdi Amini76661302017-02-10 02:44:23 +00001152inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1153inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001154
1155template <class _A1, class _A2>
1156inline _LIBCPP_INLINE_VISIBILITY
1157typename std::__lazy_enable_if
1158<
1159 std::is_arithmetic<_A1>::value &&
1160 std::is_arithmetic<_A2>::value,
1161 std::__promote<_A1, _A2>
1162>::type
1163fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1164{
1165 typedef typename std::__promote<_A1, _A2>::type __result_type;
1166 static_assert((!(std::is_same<_A1, __result_type>::value &&
1167 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001168 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001169}
1170
1171// hypot
1172
Mehdi Amini76661302017-02-10 02:44:23 +00001173inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1174inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001175
1176template <class _A1, class _A2>
1177inline _LIBCPP_INLINE_VISIBILITY
1178typename std::__lazy_enable_if
1179<
1180 std::is_arithmetic<_A1>::value &&
1181 std::is_arithmetic<_A2>::value,
1182 std::__promote<_A1, _A2>
1183>::type
1184hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1185{
1186 typedef typename std::__promote<_A1, _A2>::type __result_type;
1187 static_assert((!(std::is_same<_A1, __result_type>::value &&
1188 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001189 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001190}
1191
1192// ilogb
1193
Mehdi Amini76661302017-02-10 02:44:23 +00001194inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1195inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001196
1197template <class _A1>
1198inline _LIBCPP_INLINE_VISIBILITY
1199typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001200ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001201
1202// lgamma
1203
Mehdi Amini76661302017-02-10 02:44:23 +00001204inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1205inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001206
1207template <class _A1>
1208inline _LIBCPP_INLINE_VISIBILITY
1209typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001210lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001211
1212// llrint
1213
Mehdi Amini76661302017-02-10 02:44:23 +00001214inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1215inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001216
1217template <class _A1>
1218inline _LIBCPP_INLINE_VISIBILITY
1219typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001220llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001221
1222// llround
1223
Mehdi Amini76661302017-02-10 02:44:23 +00001224inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1225inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001226
1227template <class _A1>
1228inline _LIBCPP_INLINE_VISIBILITY
1229typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001230llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001231
1232// log1p
1233
Mehdi Amini76661302017-02-10 02:44:23 +00001234inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1235inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001236
1237template <class _A1>
1238inline _LIBCPP_INLINE_VISIBILITY
1239typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001240log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001241
1242// log2
1243
Mehdi Amini76661302017-02-10 02:44:23 +00001244inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1245inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001246
1247template <class _A1>
1248inline _LIBCPP_INLINE_VISIBILITY
1249typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001250log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001251
1252// logb
1253
Mehdi Amini76661302017-02-10 02:44:23 +00001254inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1255inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001256
1257template <class _A1>
1258inline _LIBCPP_INLINE_VISIBILITY
1259typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001260logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001261
1262// lrint
1263
Mehdi Amini76661302017-02-10 02:44:23 +00001264inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1265inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001266
1267template <class _A1>
1268inline _LIBCPP_INLINE_VISIBILITY
1269typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001270lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001271
1272// lround
1273
Mehdi Amini76661302017-02-10 02:44:23 +00001274inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1275inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001276
1277template <class _A1>
1278inline _LIBCPP_INLINE_VISIBILITY
1279typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001280lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001281
1282// nan
1283
1284// nearbyint
1285
Mehdi Amini76661302017-02-10 02:44:23 +00001286inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1287inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001288
1289template <class _A1>
1290inline _LIBCPP_INLINE_VISIBILITY
1291typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001292nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001293
1294// nextafter
1295
Mehdi Amini76661302017-02-10 02:44:23 +00001296inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1297inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001298
1299template <class _A1, class _A2>
1300inline _LIBCPP_INLINE_VISIBILITY
1301typename std::__lazy_enable_if
1302<
1303 std::is_arithmetic<_A1>::value &&
1304 std::is_arithmetic<_A2>::value,
1305 std::__promote<_A1, _A2>
1306>::type
1307nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1308{
1309 typedef typename std::__promote<_A1, _A2>::type __result_type;
1310 static_assert((!(std::is_same<_A1, __result_type>::value &&
1311 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001312 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001313}
1314
1315// nexttoward
1316
Mehdi Amini76661302017-02-10 02:44:23 +00001317inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1318inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001319
1320template <class _A1>
1321inline _LIBCPP_INLINE_VISIBILITY
1322typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001323nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001324
1325// remainder
1326
Mehdi Amini76661302017-02-10 02:44:23 +00001327inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1328inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001329
1330template <class _A1, class _A2>
1331inline _LIBCPP_INLINE_VISIBILITY
1332typename std::__lazy_enable_if
1333<
1334 std::is_arithmetic<_A1>::value &&
1335 std::is_arithmetic<_A2>::value,
1336 std::__promote<_A1, _A2>
1337>::type
1338remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1339{
1340 typedef typename std::__promote<_A1, _A2>::type __result_type;
1341 static_assert((!(std::is_same<_A1, __result_type>::value &&
1342 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001343 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith4faa3942015-10-08 20:40:34 +00001344}
1345
1346// remquo
1347
Mehdi Amini76661302017-02-10 02:44:23 +00001348inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1349inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
Richard Smith4faa3942015-10-08 20:40:34 +00001350
1351template <class _A1, class _A2>
1352inline _LIBCPP_INLINE_VISIBILITY
1353typename std::__lazy_enable_if
1354<
1355 std::is_arithmetic<_A1>::value &&
1356 std::is_arithmetic<_A2>::value,
1357 std::__promote<_A1, _A2>
1358>::type
1359remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1360{
1361 typedef typename std::__promote<_A1, _A2>::type __result_type;
1362 static_assert((!(std::is_same<_A1, __result_type>::value &&
1363 std::is_same<_A2, __result_type>::value)), "");
Mehdi Amini76661302017-02-10 02:44:23 +00001364 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith4faa3942015-10-08 20:40:34 +00001365}
1366
1367// rint
1368
Mehdi Amini76661302017-02-10 02:44:23 +00001369inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1370inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001371
1372template <class _A1>
1373inline _LIBCPP_INLINE_VISIBILITY
1374typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001375rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001376
1377// round
1378
Mehdi Amini76661302017-02-10 02:44:23 +00001379inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1380inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001381
1382template <class _A1>
1383inline _LIBCPP_INLINE_VISIBILITY
1384typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001385round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001386
1387// scalbln
1388
Mehdi Amini76661302017-02-10 02:44:23 +00001389inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1390inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001391
1392template <class _A1>
1393inline _LIBCPP_INLINE_VISIBILITY
1394typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001395scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001396
1397// scalbn
1398
Mehdi Amini76661302017-02-10 02:44:23 +00001399inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1400inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001401
1402template <class _A1>
1403inline _LIBCPP_INLINE_VISIBILITY
1404typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001405scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith4faa3942015-10-08 20:40:34 +00001406
1407// tgamma
1408
Mehdi Amini76661302017-02-10 02:44:23 +00001409inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1410inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001411
1412template <class _A1>
1413inline _LIBCPP_INLINE_VISIBILITY
1414typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001415tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001416
1417// trunc
1418
Mehdi Amini76661302017-02-10 02:44:23 +00001419inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1420inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001421
1422template <class _A1>
1423inline _LIBCPP_INLINE_VISIBILITY
1424typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Amini76661302017-02-10 02:44:23 +00001425trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
Richard Smith4faa3942015-10-08 20:40:34 +00001426
Saleem Abdulrasool29a83002017-02-17 23:08:44 +00001427#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
Richard Smith4faa3942015-10-08 20:40:34 +00001428
1429} // extern "C++"
1430
1431#endif // __cplusplus
1432
1433#endif // _LIBCPP_MATH_H