blob: 4644dd236a53c76e67fff88bee991c70b7251f10 [file] [log] [blame]
Richard Smith081bb592015-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 Abdulrasool3f7aee02017-02-13 15:26:50 +0000296#if defined(_LIBCPP_MSVCRT)
297#include <crtversion.h>
298#endif
Richard Smith081bb592015-10-08 20:40:34 +0000299
300#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
301#pragma GCC system_header
302#endif
303
Richard Smith523b1722015-10-09 00:26:50 +0000304#include_next <math.h>
305
Richard Smith081bb592015-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 Smith081bb592015-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
336#endif // signbit
337
338// fpclassify
339
340#ifdef fpclassify
341
342template <class _A1>
343_LIBCPP_ALWAYS_INLINE
344int
345__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
346{
347 return fpclassify(__lcpp_x);
348}
349
350#undef fpclassify
351
352template <class _A1>
353inline _LIBCPP_INLINE_VISIBILITY
354typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
355fpclassify(_A1 __lcpp_x) _NOEXCEPT
356{
357 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
358}
359
360#endif // fpclassify
361
362// isfinite
363
364#ifdef isfinite
365
366template <class _A1>
367_LIBCPP_ALWAYS_INLINE
368bool
369__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
370{
371 return isfinite(__lcpp_x);
372}
373
374#undef isfinite
375
376template <class _A1>
377inline _LIBCPP_INLINE_VISIBILITY
378typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
379isfinite(_A1 __lcpp_x) _NOEXCEPT
380{
381 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
382}
383
384#endif // isfinite
385
386// isinf
387
388#ifdef isinf
389
390template <class _A1>
391_LIBCPP_ALWAYS_INLINE
392bool
393__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
394{
395 return isinf(__lcpp_x);
396}
397
398#undef isinf
399
400template <class _A1>
401inline _LIBCPP_INLINE_VISIBILITY
402typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
403isinf(_A1 __lcpp_x) _NOEXCEPT
404{
405 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
406}
407
408#endif // isinf
409
410// isnan
411
412#ifdef isnan
413
414template <class _A1>
415_LIBCPP_ALWAYS_INLINE
416bool
417__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
418{
419 return isnan(__lcpp_x);
420}
421
422#undef isnan
423
424template <class _A1>
425inline _LIBCPP_INLINE_VISIBILITY
426typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
427isnan(_A1 __lcpp_x) _NOEXCEPT
428{
429 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
430}
431
432#endif // isnan
433
434// isnormal
435
436#ifdef isnormal
437
438template <class _A1>
439_LIBCPP_ALWAYS_INLINE
440bool
441__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
442{
443 return isnormal(__lcpp_x);
444}
445
446#undef isnormal
447
448template <class _A1>
449inline _LIBCPP_INLINE_VISIBILITY
450typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
451isnormal(_A1 __lcpp_x) _NOEXCEPT
452{
453 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
454}
455
456#endif // isnormal
457
458// isgreater
459
460#ifdef isgreater
461
462template <class _A1, class _A2>
463_LIBCPP_ALWAYS_INLINE
464bool
465__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
466{
467 return isgreater(__lcpp_x, __lcpp_y);
468}
469
470#undef isgreater
471
472template <class _A1, class _A2>
473inline _LIBCPP_INLINE_VISIBILITY
474typename std::enable_if
475<
476 std::is_arithmetic<_A1>::value &&
477 std::is_arithmetic<_A2>::value,
478 bool
479>::type
480isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
481{
482 typedef typename std::__promote<_A1, _A2>::type type;
483 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
484}
485
486#endif // isgreater
487
488// isgreaterequal
489
490#ifdef isgreaterequal
491
492template <class _A1, class _A2>
493_LIBCPP_ALWAYS_INLINE
494bool
495__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
496{
497 return isgreaterequal(__lcpp_x, __lcpp_y);
498}
499
500#undef isgreaterequal
501
502template <class _A1, class _A2>
503inline _LIBCPP_INLINE_VISIBILITY
504typename std::enable_if
505<
506 std::is_arithmetic<_A1>::value &&
507 std::is_arithmetic<_A2>::value,
508 bool
509>::type
510isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
511{
512 typedef typename std::__promote<_A1, _A2>::type type;
513 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
514}
515
516#endif // isgreaterequal
517
518// isless
519
520#ifdef isless
521
522template <class _A1, class _A2>
523_LIBCPP_ALWAYS_INLINE
524bool
525__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
526{
527 return isless(__lcpp_x, __lcpp_y);
528}
529
530#undef isless
531
532template <class _A1, class _A2>
533inline _LIBCPP_INLINE_VISIBILITY
534typename std::enable_if
535<
536 std::is_arithmetic<_A1>::value &&
537 std::is_arithmetic<_A2>::value,
538 bool
539>::type
540isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
541{
542 typedef typename std::__promote<_A1, _A2>::type type;
543 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
544}
545
546#endif // isless
547
548// islessequal
549
550#ifdef islessequal
551
552template <class _A1, class _A2>
553_LIBCPP_ALWAYS_INLINE
554bool
555__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
556{
557 return islessequal(__lcpp_x, __lcpp_y);
558}
559
560#undef islessequal
561
562template <class _A1, class _A2>
563inline _LIBCPP_INLINE_VISIBILITY
564typename std::enable_if
565<
566 std::is_arithmetic<_A1>::value &&
567 std::is_arithmetic<_A2>::value,
568 bool
569>::type
570islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
571{
572 typedef typename std::__promote<_A1, _A2>::type type;
573 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
574}
575
576#endif // islessequal
577
578// islessgreater
579
580#ifdef islessgreater
581
582template <class _A1, class _A2>
583_LIBCPP_ALWAYS_INLINE
584bool
585__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
586{
587 return islessgreater(__lcpp_x, __lcpp_y);
588}
589
590#undef islessgreater
591
592template <class _A1, class _A2>
593inline _LIBCPP_INLINE_VISIBILITY
594typename std::enable_if
595<
596 std::is_arithmetic<_A1>::value &&
597 std::is_arithmetic<_A2>::value,
598 bool
599>::type
600islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
601{
602 typedef typename std::__promote<_A1, _A2>::type type;
603 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
604}
605
606#endif // islessgreater
607
608// isunordered
609
610#ifdef isunordered
611
612template <class _A1, class _A2>
613_LIBCPP_ALWAYS_INLINE
614bool
615__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
616{
617 return isunordered(__lcpp_x, __lcpp_y);
618}
619
620#undef isunordered
621
622template <class _A1, class _A2>
623inline _LIBCPP_INLINE_VISIBILITY
624typename std::enable_if
625<
626 std::is_arithmetic<_A1>::value &&
627 std::is_arithmetic<_A2>::value,
628 bool
629>::type
630isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
631{
632 typedef typename std::__promote<_A1, _A2>::type type;
633 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
634}
635
636#endif // isunordered
637
Richard Smith081bb592015-10-08 20:40:34 +0000638// abs
639
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000640#if !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000641inline _LIBCPP_INLINE_VISIBILITY
642float
Mehdi Aminib3da6322017-02-10 02:44:23 +0000643abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000644
645inline _LIBCPP_INLINE_VISIBILITY
646double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000647abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000648
649inline _LIBCPP_INLINE_VISIBILITY
650long double
Mehdi Aminib3da6322017-02-10 02:44:23 +0000651abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Eric Fiselier7d1aac92016-08-15 18:58:57 +0000652#endif // !(defined(_AIX) || defined(__sun__))
Richard Smith081bb592015-10-08 20:40:34 +0000653
654// acos
655
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000656#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000657inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
658inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000659#endif
660
661template <class _A1>
662inline _LIBCPP_INLINE_VISIBILITY
663typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000664acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000665
666// asin
667
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000668#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000669inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
670inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000671#endif
672
673template <class _A1>
674inline _LIBCPP_INLINE_VISIBILITY
675typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000676asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000677
678// atan
679
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000680#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000681inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
682inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000683#endif
684
685template <class _A1>
686inline _LIBCPP_INLINE_VISIBILITY
687typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000688atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000689
690// atan2
691
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000692#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000693inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
694inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000695#endif
696
697template <class _A1, class _A2>
698inline _LIBCPP_INLINE_VISIBILITY
699typename std::__lazy_enable_if
700<
701 std::is_arithmetic<_A1>::value &&
702 std::is_arithmetic<_A2>::value,
703 std::__promote<_A1, _A2>
704>::type
705atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
706{
707 typedef typename std::__promote<_A1, _A2>::type __result_type;
708 static_assert((!(std::is_same<_A1, __result_type>::value &&
709 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000710 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
Richard Smith081bb592015-10-08 20:40:34 +0000711}
712
713// ceil
714
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000715#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000716inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
717inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000718#endif
719
720template <class _A1>
721inline _LIBCPP_INLINE_VISIBILITY
722typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000723ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000724
725// cos
726
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000727#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000728inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
729inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000730#endif
731
732template <class _A1>
733inline _LIBCPP_INLINE_VISIBILITY
734typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000735cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000736
737// cosh
738
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000739#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000740inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
741inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000742#endif
743
744template <class _A1>
745inline _LIBCPP_INLINE_VISIBILITY
746typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000747cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000748
749// exp
750
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000751#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000752inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
753inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000754#endif
755
756template <class _A1>
757inline _LIBCPP_INLINE_VISIBILITY
758typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000759exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000760
761// fabs
762
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000763#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000764inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
765inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000766#endif
767
768template <class _A1>
769inline _LIBCPP_INLINE_VISIBILITY
770typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000771fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000772
773// floor
774
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000775#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000776inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
777inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000778#endif
779
780template <class _A1>
781inline _LIBCPP_INLINE_VISIBILITY
782typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000783floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000784
785// fmod
786
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000787#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000788inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
789inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +0000790#endif
791
792template <class _A1, class _A2>
793inline _LIBCPP_INLINE_VISIBILITY
794typename std::__lazy_enable_if
795<
796 std::is_arithmetic<_A1>::value &&
797 std::is_arithmetic<_A2>::value,
798 std::__promote<_A1, _A2>
799>::type
800fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
801{
802 typedef typename std::__promote<_A1, _A2>::type __result_type;
803 static_assert((!(std::is_same<_A1, __result_type>::value &&
804 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000805 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000806}
807
808// frexp
809
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000810#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000811inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
812inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000813#endif
814
815template <class _A1>
816inline _LIBCPP_INLINE_VISIBILITY
817typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000818frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000819
820// ldexp
821
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000822#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000823inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
824inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000825#endif
826
827template <class _A1>
828inline _LIBCPP_INLINE_VISIBILITY
829typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000830ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
Richard Smith081bb592015-10-08 20:40:34 +0000831
832// log
833
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000834#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000835inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
836inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000837#endif
838
839template <class _A1>
840inline _LIBCPP_INLINE_VISIBILITY
841typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000842log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000843
844// log10
845
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000846#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000847inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
848inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000849#endif
850
851template <class _A1>
852inline _LIBCPP_INLINE_VISIBILITY
853typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000854log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000855
856// modf
857
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000858#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000859inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
860inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +0000861#endif
862
863// pow
864
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000865#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000866inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
867inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +0000868#endif
869
870template <class _A1, class _A2>
871inline _LIBCPP_INLINE_VISIBILITY
872typename std::__lazy_enable_if
873<
874 std::is_arithmetic<_A1>::value &&
875 std::is_arithmetic<_A2>::value,
876 std::__promote<_A1, _A2>
877>::type
878pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
879{
880 typedef typename std::__promote<_A1, _A2>::type __result_type;
881 static_assert((!(std::is_same<_A1, __result_type>::value &&
882 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +0000883 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +0000884}
885
886// sin
887
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000888#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000889inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
890inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000891#endif
892
893template <class _A1>
894inline _LIBCPP_INLINE_VISIBILITY
895typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000896sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000897
898// sinh
899
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000900#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000901inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
902inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000903#endif
904
905template <class _A1>
906inline _LIBCPP_INLINE_VISIBILITY
907typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000908sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000909
910// sqrt
911
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000912#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000913inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
914inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000915#endif
916
Richard Smith081bb592015-10-08 20:40:34 +0000917template <class _A1>
918inline _LIBCPP_INLINE_VISIBILITY
919typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000920sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000921
922// tan
923
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000924#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000925inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
926inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000927#endif
928
929template <class _A1>
930inline _LIBCPP_INLINE_VISIBILITY
931typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000932tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000933
934// tanh
935
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000936#if !((defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14) || defined(_AIX) || defined(__sun__))
Mehdi Aminib3da6322017-02-10 02:44:23 +0000937inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
938inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000939#endif
940
941template <class _A1>
942inline _LIBCPP_INLINE_VISIBILITY
943typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000944tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000945
946// acosh
947
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000948#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Aminib3da6322017-02-10 02:44:23 +0000949inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
950inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000951
952template <class _A1>
953inline _LIBCPP_INLINE_VISIBILITY
954typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000955acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000956#endif
957
958// asinh
959
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000960#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Aminib3da6322017-02-10 02:44:23 +0000961inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
962inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000963
964template <class _A1>
965inline _LIBCPP_INLINE_VISIBILITY
966typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000967asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000968#endif
969
970// atanh
971
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000972#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Aminib3da6322017-02-10 02:44:23 +0000973inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
974inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000975
976template <class _A1>
977inline _LIBCPP_INLINE_VISIBILITY
978typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000979atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000980#endif
981
982// cbrt
983
Saleem Abdulrasool18fd5892017-02-12 21:42:37 +0000984#if !(defined(_LIBCPP_MSVCRT) && (_VC_CRT_MAJOR_VERSION-0) < 14)
Mehdi Aminib3da6322017-02-10 02:44:23 +0000985inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
986inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000987
988template <class _A1>
989inline _LIBCPP_INLINE_VISIBILITY
990typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +0000991cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +0000992#endif
993
994// copysign
995
996#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
997inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
998 float __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +0000999 return ::copysignf(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001000}
1001inline _LIBCPP_INLINE_VISIBILITY long double
1002copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
Mehdi Aminib3da6322017-02-10 02:44:23 +00001003 return ::copysignl(__lcpp_x, __lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001004}
1005#endif
1006
1007template <class _A1, class _A2>
1008inline _LIBCPP_INLINE_VISIBILITY
1009typename std::__lazy_enable_if
1010<
1011 std::is_arithmetic<_A1>::value &&
1012 std::is_arithmetic<_A2>::value,
1013 std::__promote<_A1, _A2>
1014>::type
1015copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1016{
1017 typedef typename std::__promote<_A1, _A2>::type __result_type;
1018 static_assert((!(std::is_same<_A1, __result_type>::value &&
1019 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001020 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001021}
1022
Saleem Abdulrasooldca5e432017-02-17 23:08:44 +00001023#if !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
Richard Smith081bb592015-10-08 20:40:34 +00001024
1025// erf
1026
Mehdi Aminib3da6322017-02-10 02:44:23 +00001027inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
1028inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001029
1030template <class _A1>
1031inline _LIBCPP_INLINE_VISIBILITY
1032typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001033erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001034
1035// erfc
1036
Mehdi Aminib3da6322017-02-10 02:44:23 +00001037inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
1038inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001039
1040template <class _A1>
1041inline _LIBCPP_INLINE_VISIBILITY
1042typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001043erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001044
1045// exp2
1046
Mehdi Aminib3da6322017-02-10 02:44:23 +00001047inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
1048inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
Richard Smith081bb592015-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 Aminib3da6322017-02-10 02:44:23 +00001053exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001054
1055// expm1
1056
Mehdi Aminib3da6322017-02-10 02:44:23 +00001057inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
1058inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
Richard Smith081bb592015-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 Aminib3da6322017-02-10 02:44:23 +00001063expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001064
1065// fdim
1066
Mehdi Aminib3da6322017-02-10 02:44:23 +00001067inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
1068inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001069
1070template <class _A1, class _A2>
1071inline _LIBCPP_INLINE_VISIBILITY
1072typename std::__lazy_enable_if
1073<
1074 std::is_arithmetic<_A1>::value &&
1075 std::is_arithmetic<_A2>::value,
1076 std::__promote<_A1, _A2>
1077>::type
1078fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1079{
1080 typedef typename std::__promote<_A1, _A2>::type __result_type;
1081 static_assert((!(std::is_same<_A1, __result_type>::value &&
1082 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001083 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001084}
1085
1086// fma
1087
Mehdi Aminib3da6322017-02-10 02:44:23 +00001088inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
1089inline _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 Smith081bb592015-10-08 20:40:34 +00001090
1091template <class _A1, class _A2, class _A3>
1092inline _LIBCPP_INLINE_VISIBILITY
1093typename std::__lazy_enable_if
1094<
1095 std::is_arithmetic<_A1>::value &&
1096 std::is_arithmetic<_A2>::value &&
1097 std::is_arithmetic<_A3>::value,
1098 std::__promote<_A1, _A2, _A3>
1099>::type
1100fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1101{
1102 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1103 static_assert((!(std::is_same<_A1, __result_type>::value &&
1104 std::is_same<_A2, __result_type>::value &&
1105 std::is_same<_A3, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001106 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001107}
1108
1109// fmax
1110
Mehdi Aminib3da6322017-02-10 02:44:23 +00001111inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
1112inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001113
1114template <class _A1, class _A2>
1115inline _LIBCPP_INLINE_VISIBILITY
1116typename std::__lazy_enable_if
1117<
1118 std::is_arithmetic<_A1>::value &&
1119 std::is_arithmetic<_A2>::value,
1120 std::__promote<_A1, _A2>
1121>::type
1122fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1123{
1124 typedef typename std::__promote<_A1, _A2>::type __result_type;
1125 static_assert((!(std::is_same<_A1, __result_type>::value &&
1126 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001127 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001128}
1129
1130// fmin
1131
Mehdi Aminib3da6322017-02-10 02:44:23 +00001132inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
1133inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001134
1135template <class _A1, class _A2>
1136inline _LIBCPP_INLINE_VISIBILITY
1137typename std::__lazy_enable_if
1138<
1139 std::is_arithmetic<_A1>::value &&
1140 std::is_arithmetic<_A2>::value,
1141 std::__promote<_A1, _A2>
1142>::type
1143fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1144{
1145 typedef typename std::__promote<_A1, _A2>::type __result_type;
1146 static_assert((!(std::is_same<_A1, __result_type>::value &&
1147 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001148 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001149}
1150
1151// hypot
1152
Mehdi Aminib3da6322017-02-10 02:44:23 +00001153inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
1154inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001155
1156template <class _A1, class _A2>
1157inline _LIBCPP_INLINE_VISIBILITY
1158typename std::__lazy_enable_if
1159<
1160 std::is_arithmetic<_A1>::value &&
1161 std::is_arithmetic<_A2>::value,
1162 std::__promote<_A1, _A2>
1163>::type
1164hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1165{
1166 typedef typename std::__promote<_A1, _A2>::type __result_type;
1167 static_assert((!(std::is_same<_A1, __result_type>::value &&
1168 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001169 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001170}
1171
1172// ilogb
1173
Mehdi Aminib3da6322017-02-10 02:44:23 +00001174inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
1175inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001176
1177template <class _A1>
1178inline _LIBCPP_INLINE_VISIBILITY
1179typename std::enable_if<std::is_integral<_A1>::value, int>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001180ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001181
1182// lgamma
1183
Mehdi Aminib3da6322017-02-10 02:44:23 +00001184inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
1185inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001186
1187template <class _A1>
1188inline _LIBCPP_INLINE_VISIBILITY
1189typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001190lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001191
1192// llrint
1193
Mehdi Aminib3da6322017-02-10 02:44:23 +00001194inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
1195inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001196
1197template <class _A1>
1198inline _LIBCPP_INLINE_VISIBILITY
1199typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001200llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001201
1202// llround
1203
Mehdi Aminib3da6322017-02-10 02:44:23 +00001204inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
1205inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001206
1207template <class _A1>
1208inline _LIBCPP_INLINE_VISIBILITY
1209typename std::enable_if<std::is_integral<_A1>::value, long long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001210llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001211
1212// log1p
1213
Mehdi Aminib3da6322017-02-10 02:44:23 +00001214inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
1215inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001216
1217template <class _A1>
1218inline _LIBCPP_INLINE_VISIBILITY
1219typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001220log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001221
1222// log2
1223
Mehdi Aminib3da6322017-02-10 02:44:23 +00001224inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
1225inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001226
1227template <class _A1>
1228inline _LIBCPP_INLINE_VISIBILITY
1229typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001230log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001231
1232// logb
1233
Mehdi Aminib3da6322017-02-10 02:44:23 +00001234inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
1235inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
Richard Smith081bb592015-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 Aminib3da6322017-02-10 02:44:23 +00001240logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001241
1242// lrint
1243
Mehdi Aminib3da6322017-02-10 02:44:23 +00001244inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
1245inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001246
1247template <class _A1>
1248inline _LIBCPP_INLINE_VISIBILITY
1249typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001250lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001251
1252// lround
1253
Mehdi Aminib3da6322017-02-10 02:44:23 +00001254inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
1255inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001256
1257template <class _A1>
1258inline _LIBCPP_INLINE_VISIBILITY
1259typename std::enable_if<std::is_integral<_A1>::value, long>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001260lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001261
1262// nan
1263
1264// nearbyint
1265
Mehdi Aminib3da6322017-02-10 02:44:23 +00001266inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
1267inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001268
1269template <class _A1>
1270inline _LIBCPP_INLINE_VISIBILITY
1271typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001272nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001273
1274// nextafter
1275
Mehdi Aminib3da6322017-02-10 02:44:23 +00001276inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
1277inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001278
1279template <class _A1, class _A2>
1280inline _LIBCPP_INLINE_VISIBILITY
1281typename std::__lazy_enable_if
1282<
1283 std::is_arithmetic<_A1>::value &&
1284 std::is_arithmetic<_A2>::value,
1285 std::__promote<_A1, _A2>
1286>::type
1287nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1288{
1289 typedef typename std::__promote<_A1, _A2>::type __result_type;
1290 static_assert((!(std::is_same<_A1, __result_type>::value &&
1291 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001292 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001293}
1294
1295// nexttoward
1296
Mehdi Aminib3da6322017-02-10 02:44:23 +00001297inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
1298inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001299
1300template <class _A1>
1301inline _LIBCPP_INLINE_VISIBILITY
1302typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001303nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001304
1305// remainder
1306
Mehdi Aminib3da6322017-02-10 02:44:23 +00001307inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
1308inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001309
1310template <class _A1, class _A2>
1311inline _LIBCPP_INLINE_VISIBILITY
1312typename std::__lazy_enable_if
1313<
1314 std::is_arithmetic<_A1>::value &&
1315 std::is_arithmetic<_A2>::value,
1316 std::__promote<_A1, _A2>
1317>::type
1318remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1319{
1320 typedef typename std::__promote<_A1, _A2>::type __result_type;
1321 static_assert((!(std::is_same<_A1, __result_type>::value &&
1322 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001323 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
Richard Smith081bb592015-10-08 20:40:34 +00001324}
1325
1326// remquo
1327
Mehdi Aminib3da6322017-02-10 02:44:23 +00001328inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
1329inline _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 Smith081bb592015-10-08 20:40:34 +00001330
1331template <class _A1, class _A2>
1332inline _LIBCPP_INLINE_VISIBILITY
1333typename std::__lazy_enable_if
1334<
1335 std::is_arithmetic<_A1>::value &&
1336 std::is_arithmetic<_A2>::value,
1337 std::__promote<_A1, _A2>
1338>::type
1339remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1340{
1341 typedef typename std::__promote<_A1, _A2>::type __result_type;
1342 static_assert((!(std::is_same<_A1, __result_type>::value &&
1343 std::is_same<_A2, __result_type>::value)), "");
Mehdi Aminib3da6322017-02-10 02:44:23 +00001344 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
Richard Smith081bb592015-10-08 20:40:34 +00001345}
1346
1347// rint
1348
Mehdi Aminib3da6322017-02-10 02:44:23 +00001349inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
1350inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001351
1352template <class _A1>
1353inline _LIBCPP_INLINE_VISIBILITY
1354typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001355rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001356
1357// round
1358
Mehdi Aminib3da6322017-02-10 02:44:23 +00001359inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
1360inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001361
1362template <class _A1>
1363inline _LIBCPP_INLINE_VISIBILITY
1364typename std::enable_if<std::is_integral<_A1>::value, double>::type
Mehdi Aminib3da6322017-02-10 02:44:23 +00001365round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001366
1367// scalbln
1368
Mehdi Aminib3da6322017-02-10 02:44:23 +00001369inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
1370inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-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 Aminib3da6322017-02-10 02:44:23 +00001375scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001376
1377// scalbn
1378
Mehdi Aminib3da6322017-02-10 02:44:23 +00001379inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
1380inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-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 Aminib3da6322017-02-10 02:44:23 +00001385scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
Richard Smith081bb592015-10-08 20:40:34 +00001386
1387// tgamma
1388
Mehdi Aminib3da6322017-02-10 02:44:23 +00001389inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
1390inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
Richard Smith081bb592015-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 Aminib3da6322017-02-10 02:44:23 +00001395tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001396
1397// trunc
1398
Mehdi Aminib3da6322017-02-10 02:44:23 +00001399inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
1400inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
Richard Smith081bb592015-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 Aminib3da6322017-02-10 02:44:23 +00001405trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
Richard Smith081bb592015-10-08 20:40:34 +00001406
Saleem Abdulrasooldca5e432017-02-17 23:08:44 +00001407#endif // !(defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) < 14))
Richard Smith081bb592015-10-08 20:40:34 +00001408
1409} // extern "C++"
1410
1411#endif // __cplusplus
1412
1413#endif // _LIBCPP_MATH_H