1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef _LIBCPP_MATH_H
11 #define _LIBCPP_MATH_H
12
13 /*
14 math.h synopsis
15
16 Macros:
17
18 HUGE_VAL
19 HUGE_VALF // C99
20 HUGE_VALL // C99
21 INFINITY // C99
22 NAN // C99
23 FP_INFINITE // C99
24 FP_NAN // C99
25 FP_NORMAL // C99
26 FP_SUBNORMAL // C99
27 FP_ZERO // C99
28 FP_FAST_FMA // C99
29 FP_FAST_FMAF // C99
30 FP_FAST_FMAL // C99
31 FP_ILOGB0 // C99
32 FP_ILOGBNAN // C99
33 MATH_ERRNO // C99
34 MATH_ERREXCEPT // C99
35 math_errhandling // C99
36
37 Types:
38
39 float_t // C99
40 double_t // C99
41
42 // C90
43
44 floating_point abs(floating_point x);
45
46 floating_point acos (arithmetic x);
47 float acosf(float x);
48 long double acosl(long double x);
49
50 floating_point asin (arithmetic x);
51 float asinf(float x);
52 long double asinl(long double x);
53
54 floating_point atan (arithmetic x);
55 float atanf(float x);
56 long double atanl(long double x);
57
58 floating_point atan2 (arithmetic y, arithmetic x);
59 float atan2f(float y, float x);
60 long double atan2l(long double y, long double x);
61
62 floating_point ceil (arithmetic x);
63 float ceilf(float x);
64 long double ceill(long double x);
65
66 floating_point cos (arithmetic x);
67 float cosf(float x);
68 long double cosl(long double x);
69
70 floating_point cosh (arithmetic x);
71 float coshf(float x);
72 long double coshl(long double x);
73
74 floating_point exp (arithmetic x);
75 float expf(float x);
76 long double expl(long double x);
77
78 floating_point fabs (arithmetic x);
79 float fabsf(float x);
80 long double fabsl(long double x);
81
82 floating_point floor (arithmetic x);
83 float floorf(float x);
84 long double floorl(long double x);
85
86 floating_point fmod (arithmetic x, arithmetic y);
87 float fmodf(float x, float y);
88 long double fmodl(long double x, long double y);
89
90 floating_point frexp (arithmetic value, int* exp);
91 float frexpf(float value, int* exp);
92 long double frexpl(long double value, int* exp);
93
94 floating_point ldexp (arithmetic value, int exp);
95 float ldexpf(float value, int exp);
96 long double ldexpl(long double value, int exp);
97
98 floating_point log (arithmetic x);
99 float logf(float x);
100 long double logl(long double x);
101
102 floating_point log10 (arithmetic x);
103 float log10f(float x);
104 long double log10l(long double x);
105
106 floating_point modf (floating_point value, floating_point* iptr);
107 float modff(float value, float* iptr);
108 long double modfl(long double value, long double* iptr);
109
110 floating_point pow (arithmetic x, arithmetic y);
111 float powf(float x, float y);
112 long double powl(long double x, long double y);
113
114 floating_point sin (arithmetic x);
115 float sinf(float x);
116 long double sinl(long double x);
117
118 floating_point sinh (arithmetic x);
119 float sinhf(float x);
120 long double sinhl(long double x);
121
122 floating_point sqrt (arithmetic x);
123 float sqrtf(float x);
124 long double sqrtl(long double x);
125
126 floating_point tan (arithmetic x);
127 float tanf(float x);
128 long double tanl(long double x);
129
130 floating_point tanh (arithmetic x);
131 float tanhf(float x);
132 long double tanhl(long double x);
133
134 // C99
135
136 bool signbit(arithmetic x);
137
138 int fpclassify(arithmetic x);
139
140 bool isfinite(arithmetic x);
141 bool isinf(arithmetic x);
142 bool isnan(arithmetic x);
143 bool isnormal(arithmetic x);
144
145 bool isgreater(arithmetic x, arithmetic y);
146 bool isgreaterequal(arithmetic x, arithmetic y);
147 bool isless(arithmetic x, arithmetic y);
148 bool islessequal(arithmetic x, arithmetic y);
149 bool islessgreater(arithmetic x, arithmetic y);
150 bool isunordered(arithmetic x, arithmetic y);
151
152 floating_point acosh (arithmetic x);
153 float acoshf(float x);
154 long double acoshl(long double x);
155
156 floating_point asinh (arithmetic x);
157 float asinhf(float x);
158 long double asinhl(long double x);
159
160 floating_point atanh (arithmetic x);
161 float atanhf(float x);
162 long double atanhl(long double x);
163
164 floating_point cbrt (arithmetic x);
165 float cbrtf(float x);
166 long double cbrtl(long double x);
167
168 floating_point copysign (arithmetic x, arithmetic y);
169 float copysignf(float x, float y);
170 long double copysignl(long double x, long double y);
171
172 floating_point erf (arithmetic x);
173 float erff(float x);
174 long double erfl(long double x);
175
176 floating_point erfc (arithmetic x);
177 float erfcf(float x);
178 long double erfcl(long double x);
179
180 floating_point exp2 (arithmetic x);
181 float exp2f(float x);
182 long double exp2l(long double x);
183
184 floating_point expm1 (arithmetic x);
185 float expm1f(float x);
186 long double expm1l(long double x);
187
188 floating_point fdim (arithmetic x, arithmetic y);
189 float fdimf(float x, float y);
190 long double fdiml(long double x, long double y);
191
192 floating_point fma (arithmetic x, arithmetic y, arithmetic z);
193 float fmaf(float x, float y, float z);
194 long double fmal(long double x, long double y, long double z);
195
196 floating_point fmax (arithmetic x, arithmetic y);
197 float fmaxf(float x, float y);
198 long double fmaxl(long double x, long double y);
199
200 floating_point fmin (arithmetic x, arithmetic y);
201 float fminf(float x, float y);
202 long double fminl(long double x, long double y);
203
204 floating_point hypot (arithmetic x, arithmetic y);
205 float hypotf(float x, float y);
206 long double hypotl(long double x, long double y);
207
208 int ilogb (arithmetic x);
209 int ilogbf(float x);
210 int ilogbl(long double x);
211
212 floating_point lgamma (arithmetic x);
213 float lgammaf(float x);
214 long double lgammal(long double x);
215
216 long long llrint (arithmetic x);
217 long long llrintf(float x);
218 long long llrintl(long double x);
219
220 long long llround (arithmetic x);
221 long long llroundf(float x);
222 long long llroundl(long double x);
223
224 floating_point log1p (arithmetic x);
225 float log1pf(float x);
226 long double log1pl(long double x);
227
228 floating_point log2 (arithmetic x);
229 float log2f(float x);
230 long double log2l(long double x);
231
232 floating_point logb (arithmetic x);
233 float logbf(float x);
234 long double logbl(long double x);
235
236 long lrint (arithmetic x);
237 long lrintf(float x);
238 long lrintl(long double x);
239
240 long lround (arithmetic x);
241 long lroundf(float x);
242 long lroundl(long double x);
243
244 double nan (const char* str);
245 float nanf(const char* str);
246 long double nanl(const char* str);
247
248 floating_point nearbyint (arithmetic x);
249 float nearbyintf(float x);
250 long double nearbyintl(long double x);
251
252 floating_point nextafter (arithmetic x, arithmetic y);
253 float nextafterf(float x, float y);
254 long double nextafterl(long double x, long double y);
255
256 floating_point nexttoward (arithmetic x, long double y);
257 float nexttowardf(float x, long double y);
258 long double nexttowardl(long double x, long double y);
259
260 floating_point remainder (arithmetic x, arithmetic y);
261 float remainderf(float x, float y);
262 long double remainderl(long double x, long double y);
263
264 floating_point remquo (arithmetic x, arithmetic y, int* pquo);
265 float remquof(float x, float y, int* pquo);
266 long double remquol(long double x, long double y, int* pquo);
267
268 floating_point rint (arithmetic x);
269 float rintf(float x);
270 long double rintl(long double x);
271
272 floating_point round (arithmetic x);
273 float roundf(float x);
274 long double roundl(long double x);
275
276 floating_point scalbln (arithmetic x, long ex);
277 float scalblnf(float x, long ex);
278 long double scalblnl(long double x, long ex);
279
280 floating_point scalbn (arithmetic x, int ex);
281 float scalbnf(float x, int ex);
282 long double scalbnl(long double x, int ex);
283
284 floating_point tgamma (arithmetic x);
285 float tgammaf(float x);
286 long double tgammal(long double x);
287
288 floating_point trunc (arithmetic x);
289 float truncf(float x);
290 long double truncl(long double x);
291
292 */
293
294 #include <__config>
295
296 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
297 # pragma GCC system_header
298 #endif
299
300 #include_next <math.h>
301
302 #ifdef __cplusplus
303
304 // We support including .h headers inside 'extern "C"' contexts, so switch
305 // back to C++ linkage before including these C++ headers.
306 extern "C++" {
307
308 #include <__type_traits/promote.h>
309 #include <limits>
310 #include <stdlib.h>
311 #include <type_traits>
312
313 // signbit
314
315 #ifdef signbit
316
317 template <class _A1>
318 _LIBCPP_INLINE_VISIBILITY
319 bool
__libcpp_signbit(_A1 __lcpp_x)320 __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
321 {
322 #if __has_builtin(__builtin_signbit)
323 return __builtin_signbit(__lcpp_x);
324 #else
325 return signbit(__lcpp_x);
326 #endif
327 }
328
329 #undef signbit
330
331 template <class _A1>
332 inline _LIBCPP_INLINE_VISIBILITY
333 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
signbit(_A1 __lcpp_x)334 signbit(_A1 __lcpp_x) _NOEXCEPT
335 {
336 return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
337 }
338
339 template <class _A1>
340 inline _LIBCPP_INLINE_VISIBILITY
341 typename std::enable_if<
342 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
signbit(_A1 __lcpp_x)343 signbit(_A1 __lcpp_x) _NOEXCEPT
344 { return __lcpp_x < 0; }
345
346 template <class _A1>
347 inline _LIBCPP_INLINE_VISIBILITY
348 typename std::enable_if<
349 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
signbit(_A1)350 signbit(_A1) _NOEXCEPT
351 { return false; }
352
353 #elif defined(_LIBCPP_MSVCRT)
354
355 template <typename _A1>
356 inline _LIBCPP_INLINE_VISIBILITY
357 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
358 signbit(_A1 __lcpp_x) _NOEXCEPT
359 {
360 return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
361 }
362
363 template <class _A1>
364 inline _LIBCPP_INLINE_VISIBILITY
365 typename std::enable_if<
366 std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
367 signbit(_A1 __lcpp_x) _NOEXCEPT
368 { return __lcpp_x < 0; }
369
370 template <class _A1>
371 inline _LIBCPP_INLINE_VISIBILITY
372 typename std::enable_if<
373 std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
374 signbit(_A1) _NOEXCEPT
375 { return false; }
376
377 #endif // signbit
378
379 // fpclassify
380
381 #ifdef fpclassify
382
383 template <class _A1>
384 _LIBCPP_INLINE_VISIBILITY
385 int
__libcpp_fpclassify(_A1 __lcpp_x)386 __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
387 {
388 #if __has_builtin(__builtin_fpclassify)
389 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
390 FP_ZERO, __lcpp_x);
391 #else
392 return fpclassify(__lcpp_x);
393 #endif
394 }
395
396 #undef fpclassify
397
398 template <class _A1>
399 inline _LIBCPP_INLINE_VISIBILITY
400 typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
fpclassify(_A1 __lcpp_x)401 fpclassify(_A1 __lcpp_x) _NOEXCEPT
402 {
403 return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
404 }
405
406 template <class _A1>
407 inline _LIBCPP_INLINE_VISIBILITY
408 typename std::enable_if<std::is_integral<_A1>::value, int>::type
fpclassify(_A1 __lcpp_x)409 fpclassify(_A1 __lcpp_x) _NOEXCEPT
410 { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
411
412 #elif defined(_LIBCPP_MSVCRT)
413
414 template <typename _A1>
415 inline _LIBCPP_INLINE_VISIBILITY
416 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
fpclassify(_A1 __lcpp_x)417 fpclassify(_A1 __lcpp_x) _NOEXCEPT
418 {
419 return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
420 }
421
422 template <class _A1>
423 inline _LIBCPP_INLINE_VISIBILITY
424 typename std::enable_if<std::is_integral<_A1>::value, int>::type
fpclassify(_A1 __lcpp_x)425 fpclassify(_A1 __lcpp_x) _NOEXCEPT
426 { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
427
428 #endif // fpclassify
429
430 // isfinite
431
432 #ifdef isfinite
433
434 template <class _A1>
435 _LIBCPP_INLINE_VISIBILITY
436 bool
__libcpp_isfinite(_A1 __lcpp_x)437 __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
438 {
439 #if __has_builtin(__builtin_isfinite)
440 return __builtin_isfinite(__lcpp_x);
441 #else
442 return isfinite(__lcpp_x);
443 #endif
444 }
445
446 #undef isfinite
447
448 template <class _A1>
449 inline _LIBCPP_INLINE_VISIBILITY
450 typename std::enable_if<
451 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
452 bool>::type
isfinite(_A1 __lcpp_x)453 isfinite(_A1 __lcpp_x) _NOEXCEPT
454 {
455 return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
456 }
457
458 template <class _A1>
459 inline _LIBCPP_INLINE_VISIBILITY
460 typename std::enable_if<
461 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
462 bool>::type
isfinite(_A1)463 isfinite(_A1) _NOEXCEPT
464 { return true; }
465
466 #endif // isfinite
467
468 // isinf
469
470 #ifdef isinf
471
472 template <class _A1>
473 _LIBCPP_INLINE_VISIBILITY
474 bool
__libcpp_isinf(_A1 __lcpp_x)475 __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
476 {
477 #if __has_builtin(__builtin_isinf)
478 return __builtin_isinf(__lcpp_x);
479 #else
480 return isinf(__lcpp_x);
481 #endif
482 }
483
484 #undef isinf
485
486 template <class _A1>
487 inline _LIBCPP_INLINE_VISIBILITY
488 typename std::enable_if<
489 std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
490 bool>::type
isinf(_A1 __lcpp_x)491 isinf(_A1 __lcpp_x) _NOEXCEPT
492 {
493 return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
494 }
495
496 template <class _A1>
497 inline _LIBCPP_INLINE_VISIBILITY
498 typename std::enable_if<
499 std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
500 bool>::type
isinf(_A1)501 isinf(_A1) _NOEXCEPT
502 { return false; }
503
504 #ifdef _LIBCPP_PREFERRED_OVERLOAD
505 inline _LIBCPP_INLINE_VISIBILITY
506 bool
isinf(float __lcpp_x)507 isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
508
509 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
510 bool
isinf(double __lcpp_x)511 isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
512
513 inline _LIBCPP_INLINE_VISIBILITY
514 bool
isinf(long double __lcpp_x)515 isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
516 #endif
517
518 #endif // isinf
519
520 // isnan
521
522 #ifdef isnan
523
524 template <class _A1>
525 _LIBCPP_INLINE_VISIBILITY
526 bool
__libcpp_isnan(_A1 __lcpp_x)527 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
528 {
529 #if __has_builtin(__builtin_isnan)
530 return __builtin_isnan(__lcpp_x);
531 #else
532 return isnan(__lcpp_x);
533 #endif
534 }
535
536 #undef isnan
537
538 template <class _A1>
539 inline _LIBCPP_INLINE_VISIBILITY
540 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnan(_A1 __lcpp_x)541 isnan(_A1 __lcpp_x) _NOEXCEPT
542 {
543 return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
544 }
545
546 template <class _A1>
547 inline _LIBCPP_INLINE_VISIBILITY
548 typename std::enable_if<std::is_integral<_A1>::value, bool>::type
isnan(_A1)549 isnan(_A1) _NOEXCEPT
550 { return false; }
551
552 #ifdef _LIBCPP_PREFERRED_OVERLOAD
553 inline _LIBCPP_INLINE_VISIBILITY
554 bool
isnan(float __lcpp_x)555 isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
556
557 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
558 bool
isnan(double __lcpp_x)559 isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
560
561 inline _LIBCPP_INLINE_VISIBILITY
562 bool
isnan(long double __lcpp_x)563 isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
564 #endif
565
566 #endif // isnan
567
568 // isnormal
569
570 #ifdef isnormal
571
572 template <class _A1>
573 _LIBCPP_INLINE_VISIBILITY
574 bool
__libcpp_isnormal(_A1 __lcpp_x)575 __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
576 {
577 #if __has_builtin(__builtin_isnormal)
578 return __builtin_isnormal(__lcpp_x);
579 #else
580 return isnormal(__lcpp_x);
581 #endif
582 }
583
584 #undef isnormal
585
586 template <class _A1>
587 inline _LIBCPP_INLINE_VISIBILITY
588 typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnormal(_A1 __lcpp_x)589 isnormal(_A1 __lcpp_x) _NOEXCEPT
590 {
591 return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
592 }
593
594 template <class _A1>
595 inline _LIBCPP_INLINE_VISIBILITY
596 typename std::enable_if<std::is_integral<_A1>::value, bool>::type
isnormal(_A1 __lcpp_x)597 isnormal(_A1 __lcpp_x) _NOEXCEPT
598 { return __lcpp_x != 0; }
599
600 #endif // isnormal
601
602 // isgreater
603
604 #ifdef isgreater
605
606 template <class _A1, class _A2>
607 _LIBCPP_INLINE_VISIBILITY
608 bool
__libcpp_isgreater(_A1 __lcpp_x,_A2 __lcpp_y)609 __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
610 {
611 return isgreater(__lcpp_x, __lcpp_y);
612 }
613
614 #undef isgreater
615
616 template <class _A1, class _A2>
617 inline _LIBCPP_INLINE_VISIBILITY
618 typename std::enable_if
619 <
620 std::is_arithmetic<_A1>::value &&
621 std::is_arithmetic<_A2>::value,
622 bool
623 >::type
isgreater(_A1 __lcpp_x,_A2 __lcpp_y)624 isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
625 {
626 typedef typename std::__promote<_A1, _A2>::type type;
627 return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
628 }
629
630 #endif // isgreater
631
632 // isgreaterequal
633
634 #ifdef isgreaterequal
635
636 template <class _A1, class _A2>
637 _LIBCPP_INLINE_VISIBILITY
638 bool
__libcpp_isgreaterequal(_A1 __lcpp_x,_A2 __lcpp_y)639 __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
640 {
641 return isgreaterequal(__lcpp_x, __lcpp_y);
642 }
643
644 #undef isgreaterequal
645
646 template <class _A1, class _A2>
647 inline _LIBCPP_INLINE_VISIBILITY
648 typename std::enable_if
649 <
650 std::is_arithmetic<_A1>::value &&
651 std::is_arithmetic<_A2>::value,
652 bool
653 >::type
isgreaterequal(_A1 __lcpp_x,_A2 __lcpp_y)654 isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
655 {
656 typedef typename std::__promote<_A1, _A2>::type type;
657 return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
658 }
659
660 #endif // isgreaterequal
661
662 // isless
663
664 #ifdef isless
665
666 template <class _A1, class _A2>
667 _LIBCPP_INLINE_VISIBILITY
668 bool
__libcpp_isless(_A1 __lcpp_x,_A2 __lcpp_y)669 __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
670 {
671 return isless(__lcpp_x, __lcpp_y);
672 }
673
674 #undef isless
675
676 template <class _A1, class _A2>
677 inline _LIBCPP_INLINE_VISIBILITY
678 typename std::enable_if
679 <
680 std::is_arithmetic<_A1>::value &&
681 std::is_arithmetic<_A2>::value,
682 bool
683 >::type
isless(_A1 __lcpp_x,_A2 __lcpp_y)684 isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
685 {
686 typedef typename std::__promote<_A1, _A2>::type type;
687 return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
688 }
689
690 #endif // isless
691
692 // islessequal
693
694 #ifdef islessequal
695
696 template <class _A1, class _A2>
697 _LIBCPP_INLINE_VISIBILITY
698 bool
__libcpp_islessequal(_A1 __lcpp_x,_A2 __lcpp_y)699 __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
700 {
701 return islessequal(__lcpp_x, __lcpp_y);
702 }
703
704 #undef islessequal
705
706 template <class _A1, class _A2>
707 inline _LIBCPP_INLINE_VISIBILITY
708 typename std::enable_if
709 <
710 std::is_arithmetic<_A1>::value &&
711 std::is_arithmetic<_A2>::value,
712 bool
713 >::type
islessequal(_A1 __lcpp_x,_A2 __lcpp_y)714 islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
715 {
716 typedef typename std::__promote<_A1, _A2>::type type;
717 return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
718 }
719
720 #endif // islessequal
721
722 // islessgreater
723
724 #ifdef islessgreater
725
726 template <class _A1, class _A2>
727 _LIBCPP_INLINE_VISIBILITY
728 bool
__libcpp_islessgreater(_A1 __lcpp_x,_A2 __lcpp_y)729 __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
730 {
731 return islessgreater(__lcpp_x, __lcpp_y);
732 }
733
734 #undef islessgreater
735
736 template <class _A1, class _A2>
737 inline _LIBCPP_INLINE_VISIBILITY
738 typename std::enable_if
739 <
740 std::is_arithmetic<_A1>::value &&
741 std::is_arithmetic<_A2>::value,
742 bool
743 >::type
islessgreater(_A1 __lcpp_x,_A2 __lcpp_y)744 islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
745 {
746 typedef typename std::__promote<_A1, _A2>::type type;
747 return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
748 }
749
750 #endif // islessgreater
751
752 // isunordered
753
754 #ifdef isunordered
755
756 template <class _A1, class _A2>
757 _LIBCPP_INLINE_VISIBILITY
758 bool
__libcpp_isunordered(_A1 __lcpp_x,_A2 __lcpp_y)759 __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
760 {
761 return isunordered(__lcpp_x, __lcpp_y);
762 }
763
764 #undef isunordered
765
766 template <class _A1, class _A2>
767 inline _LIBCPP_INLINE_VISIBILITY
768 typename std::enable_if
769 <
770 std::is_arithmetic<_A1>::value &&
771 std::is_arithmetic<_A2>::value,
772 bool
773 >::type
isunordered(_A1 __lcpp_x,_A2 __lcpp_y)774 isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
775 {
776 typedef typename std::__promote<_A1, _A2>::type type;
777 return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
778 }
779
780 #endif // isunordered
781
782 // abs
783 //
784 // handled in stdlib.h
785
786 // div
787 //
788 // handled in stdlib.h
789
790 // acos
791
792 # if !defined(__sun__)
acos(float __lcpp_x)793 inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
acos(long double __lcpp_x)794 inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
795 # endif
796
797 template <class _A1>
798 inline _LIBCPP_INLINE_VISIBILITY
799 typename std::enable_if<std::is_integral<_A1>::value, double>::type
acos(_A1 __lcpp_x)800 acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
801
802 // asin
803
804 # if !defined(__sun__)
asin(float __lcpp_x)805 inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
asin(long double __lcpp_x)806 inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
807 # endif
808
809 template <class _A1>
810 inline _LIBCPP_INLINE_VISIBILITY
811 typename std::enable_if<std::is_integral<_A1>::value, double>::type
asin(_A1 __lcpp_x)812 asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
813
814 // atan
815
816 # if !defined(__sun__)
atan(float __lcpp_x)817 inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
atan(long double __lcpp_x)818 inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
819 # endif
820
821 template <class _A1>
822 inline _LIBCPP_INLINE_VISIBILITY
823 typename std::enable_if<std::is_integral<_A1>::value, double>::type
atan(_A1 __lcpp_x)824 atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
825
826 // atan2
827
828 # if !defined(__sun__)
atan2(float __lcpp_y,float __lcpp_x)829 inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
atan2(long double __lcpp_y,long double __lcpp_x)830 inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
831 # endif
832
833 template <class _A1, class _A2>
834 inline _LIBCPP_INLINE_VISIBILITY
835 typename std::__enable_if_t
836 <
837 std::is_arithmetic<_A1>::value &&
838 std::is_arithmetic<_A2>::value,
839 std::__promote<_A1, _A2>
840 >::type
atan2(_A1 __lcpp_y,_A2 __lcpp_x)841 atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
842 {
843 typedef typename std::__promote<_A1, _A2>::type __result_type;
844 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
845 std::_IsSame<_A2, __result_type>::value)), "");
846 return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
847 }
848
849 // ceil
850
851 # if !defined(__sun__)
ceil(float __lcpp_x)852 inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
ceil(long double __lcpp_x)853 inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
854 # endif
855
856 template <class _A1>
857 inline _LIBCPP_INLINE_VISIBILITY
858 typename std::enable_if<std::is_integral<_A1>::value, double>::type
ceil(_A1 __lcpp_x)859 ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
860
861 // cos
862
863 # if !defined(__sun__)
cos(float __lcpp_x)864 inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
cos(long double __lcpp_x)865 inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
866 # endif
867
868 template <class _A1>
869 inline _LIBCPP_INLINE_VISIBILITY
870 typename std::enable_if<std::is_integral<_A1>::value, double>::type
cos(_A1 __lcpp_x)871 cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
872
873 // cosh
874
875 # if !defined(__sun__)
cosh(float __lcpp_x)876 inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
cosh(long double __lcpp_x)877 inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
878 # endif
879
880 template <class _A1>
881 inline _LIBCPP_INLINE_VISIBILITY
882 typename std::enable_if<std::is_integral<_A1>::value, double>::type
cosh(_A1 __lcpp_x)883 cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
884
885 // exp
886
887 # if !defined(__sun__)
exp(float __lcpp_x)888 inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
exp(long double __lcpp_x)889 inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
890 # endif
891
892 template <class _A1>
893 inline _LIBCPP_INLINE_VISIBILITY
894 typename std::enable_if<std::is_integral<_A1>::value, double>::type
exp(_A1 __lcpp_x)895 exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
896
897 // fabs
898
899 # if !defined(__sun__)
fabs(float __lcpp_x)900 inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
fabs(long double __lcpp_x)901 inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
902 # endif
903
904 template <class _A1>
905 inline _LIBCPP_INLINE_VISIBILITY
906 typename std::enable_if<std::is_integral<_A1>::value, double>::type
fabs(_A1 __lcpp_x)907 fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
908
909 // floor
910
911 # if !defined(__sun__)
floor(float __lcpp_x)912 inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
floor(long double __lcpp_x)913 inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
914 # endif
915
916 template <class _A1>
917 inline _LIBCPP_INLINE_VISIBILITY
918 typename std::enable_if<std::is_integral<_A1>::value, double>::type
floor(_A1 __lcpp_x)919 floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
920
921 // fmod
922
923 # if !defined(__sun__)
fmod(float __lcpp_x,float __lcpp_y)924 inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
fmod(long double __lcpp_x,long double __lcpp_y)925 inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
926 # endif
927
928 template <class _A1, class _A2>
929 inline _LIBCPP_INLINE_VISIBILITY
930 typename std::__enable_if_t
931 <
932 std::is_arithmetic<_A1>::value &&
933 std::is_arithmetic<_A2>::value,
934 std::__promote<_A1, _A2>
935 >::type
fmod(_A1 __lcpp_x,_A2 __lcpp_y)936 fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
937 {
938 typedef typename std::__promote<_A1, _A2>::type __result_type;
939 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
940 std::_IsSame<_A2, __result_type>::value)), "");
941 return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
942 }
943
944 // frexp
945
946 # if !defined(__sun__)
frexp(float __lcpp_x,int * __lcpp_e)947 inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
frexp(long double __lcpp_x,int * __lcpp_e)948 inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
949 # endif
950
951 template <class _A1>
952 inline _LIBCPP_INLINE_VISIBILITY
953 typename std::enable_if<std::is_integral<_A1>::value, double>::type
frexp(_A1 __lcpp_x,int * __lcpp_e)954 frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
955
956 // ldexp
957
958 # if !defined(__sun__)
ldexp(float __lcpp_x,int __lcpp_e)959 inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
ldexp(long double __lcpp_x,int __lcpp_e)960 inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
961 # endif
962
963 template <class _A1>
964 inline _LIBCPP_INLINE_VISIBILITY
965 typename std::enable_if<std::is_integral<_A1>::value, double>::type
ldexp(_A1 __lcpp_x,int __lcpp_e)966 ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
967
968 // log
969
970 # if !defined(__sun__)
log(float __lcpp_x)971 inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
log(long double __lcpp_x)972 inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
973 # endif
974
975 template <class _A1>
976 inline _LIBCPP_INLINE_VISIBILITY
977 typename std::enable_if<std::is_integral<_A1>::value, double>::type
log(_A1 __lcpp_x)978 log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
979
980 // log10
981
982 # if !defined(__sun__)
log10(float __lcpp_x)983 inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
log10(long double __lcpp_x)984 inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
985 # endif
986
987 template <class _A1>
988 inline _LIBCPP_INLINE_VISIBILITY
989 typename std::enable_if<std::is_integral<_A1>::value, double>::type
log10(_A1 __lcpp_x)990 log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
991
992 // modf
993
994 # if !defined(__sun__)
modf(float __lcpp_x,float * __lcpp_y)995 inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
modf(long double __lcpp_x,long double * __lcpp_y)996 inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
997 # endif
998
999 // pow
1000
1001 # if !defined(__sun__)
pow(float __lcpp_x,float __lcpp_y)1002 inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
pow(long double __lcpp_x,long double __lcpp_y)1003 inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
1004 # endif
1005
1006 template <class _A1, class _A2>
1007 inline _LIBCPP_INLINE_VISIBILITY
1008 typename std::__enable_if_t
1009 <
1010 std::is_arithmetic<_A1>::value &&
1011 std::is_arithmetic<_A2>::value,
1012 std::__promote<_A1, _A2>
1013 >::type
pow(_A1 __lcpp_x,_A2 __lcpp_y)1014 pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1015 {
1016 typedef typename std::__promote<_A1, _A2>::type __result_type;
1017 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1018 std::_IsSame<_A2, __result_type>::value)), "");
1019 return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1020 }
1021
1022 // sin
1023
1024 # if !defined(__sun__)
sin(float __lcpp_x)1025 inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
sin(long double __lcpp_x)1026 inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
1027 #endif
1028
1029 template <class _A1>
1030 inline _LIBCPP_INLINE_VISIBILITY
1031 typename std::enable_if<std::is_integral<_A1>::value, double>::type
sin(_A1 __lcpp_x)1032 sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
1033
1034 // sinh
1035
1036 # if !defined(__sun__)
sinh(float __lcpp_x)1037 inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
sinh(long double __lcpp_x)1038 inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
1039 # endif
1040
1041 template <class _A1>
1042 inline _LIBCPP_INLINE_VISIBILITY
1043 typename std::enable_if<std::is_integral<_A1>::value, double>::type
sinh(_A1 __lcpp_x)1044 sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
1045
1046 // sqrt
1047
1048 # if !defined(__sun__)
sqrt(float __lcpp_x)1049 inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
sqrt(long double __lcpp_x)1050 inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
1051 # endif
1052
1053 template <class _A1>
1054 inline _LIBCPP_INLINE_VISIBILITY
1055 typename std::enable_if<std::is_integral<_A1>::value, double>::type
sqrt(_A1 __lcpp_x)1056 sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
1057
1058 // tan
1059
1060 # if !defined(__sun__)
tan(float __lcpp_x)1061 inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
tan(long double __lcpp_x)1062 inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
1063 # endif
1064
1065 template <class _A1>
1066 inline _LIBCPP_INLINE_VISIBILITY
1067 typename std::enable_if<std::is_integral<_A1>::value, double>::type
tan(_A1 __lcpp_x)1068 tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
1069
1070 // tanh
1071
1072 # if !defined(__sun__)
tanh(float __lcpp_x)1073 inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
tanh(long double __lcpp_x)1074 inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
1075 # endif
1076
1077 template <class _A1>
1078 inline _LIBCPP_INLINE_VISIBILITY
1079 typename std::enable_if<std::is_integral<_A1>::value, double>::type
tanh(_A1 __lcpp_x)1080 tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
1081
1082 // acosh
1083
acosh(float __lcpp_x)1084 inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
acosh(long double __lcpp_x)1085 inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
1086
1087 template <class _A1>
1088 inline _LIBCPP_INLINE_VISIBILITY
1089 typename std::enable_if<std::is_integral<_A1>::value, double>::type
acosh(_A1 __lcpp_x)1090 acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
1091
1092 // asinh
1093
asinh(float __lcpp_x)1094 inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
asinh(long double __lcpp_x)1095 inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
1096
1097 template <class _A1>
1098 inline _LIBCPP_INLINE_VISIBILITY
1099 typename std::enable_if<std::is_integral<_A1>::value, double>::type
asinh(_A1 __lcpp_x)1100 asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
1101
1102 // atanh
1103
atanh(float __lcpp_x)1104 inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
atanh(long double __lcpp_x)1105 inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
1106
1107 template <class _A1>
1108 inline _LIBCPP_INLINE_VISIBILITY
1109 typename std::enable_if<std::is_integral<_A1>::value, double>::type
atanh(_A1 __lcpp_x)1110 atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
1111
1112 // cbrt
1113
cbrt(float __lcpp_x)1114 inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
cbrt(long double __lcpp_x)1115 inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
1116
1117 template <class _A1>
1118 inline _LIBCPP_INLINE_VISIBILITY
1119 typename std::enable_if<std::is_integral<_A1>::value, double>::type
cbrt(_A1 __lcpp_x)1120 cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
1121
1122 // copysign
1123
1124 #if __has_builtin(__builtin_copysignf)
1125 _LIBCPP_CONSTEXPR
1126 #endif
__libcpp_copysign(float __lcpp_x,float __lcpp_y)1127 inline _LIBCPP_INLINE_VISIBILITY float __libcpp_copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT {
1128 #if __has_builtin(__builtin_copysignf)
1129 return __builtin_copysignf(__lcpp_x, __lcpp_y);
1130 #else
1131 return ::copysignf(__lcpp_x, __lcpp_y);
1132 #endif
1133 }
1134
1135 #if __has_builtin(__builtin_copysign)
1136 _LIBCPP_CONSTEXPR
1137 #endif
__libcpp_copysign(double __lcpp_x,double __lcpp_y)1138 inline _LIBCPP_INLINE_VISIBILITY double __libcpp_copysign(double __lcpp_x, double __lcpp_y) _NOEXCEPT {
1139 #if __has_builtin(__builtin_copysign)
1140 return __builtin_copysign(__lcpp_x, __lcpp_y);
1141 #else
1142 return ::copysign(__lcpp_x, __lcpp_y);
1143 #endif
1144 }
1145
1146 #if __has_builtin(__builtin_copysignl)
1147 _LIBCPP_CONSTEXPR
1148 #endif
__libcpp_copysign(long double __lcpp_x,long double __lcpp_y)1149 inline _LIBCPP_INLINE_VISIBILITY long double __libcpp_copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
1150 #if __has_builtin(__builtin_copysignl)
1151 return __builtin_copysignl(__lcpp_x, __lcpp_y);
1152 #else
1153 return ::copysignl(__lcpp_x, __lcpp_y);
1154 #endif
1155 }
1156
1157 template <class _A1, class _A2>
1158 #if __has_builtin(__builtin_copysign)
1159 _LIBCPP_CONSTEXPR
1160 #endif
1161 inline _LIBCPP_INLINE_VISIBILITY
1162 typename std::__enable_if_t
1163 <
1164 std::is_arithmetic<_A1>::value &&
1165 std::is_arithmetic<_A2>::value,
1166 std::__promote<_A1, _A2>
1167 >::type
__libcpp_copysign(_A1 __lcpp_x,_A2 __lcpp_y)1168 __libcpp_copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT {
1169 typedef typename std::__promote<_A1, _A2>::type __result_type;
1170 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1171 std::_IsSame<_A2, __result_type>::value)), "");
1172 #if __has_builtin(__builtin_copysign)
1173 return __builtin_copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1174 #else
1175 return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1176 #endif
1177 }
1178
copysign(float __lcpp_x,float __lcpp_y)1179 inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT {
1180 return ::__libcpp_copysign(__lcpp_x, __lcpp_y);
1181 }
1182
copysign(long double __lcpp_x,long double __lcpp_y)1183 inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
1184 return ::__libcpp_copysign(__lcpp_x, __lcpp_y);
1185 }
1186
1187 template <class _A1, class _A2>
1188 inline _LIBCPP_INLINE_VISIBILITY
1189 typename std::__enable_if_t
1190 <
1191 std::is_arithmetic<_A1>::value &&
1192 std::is_arithmetic<_A2>::value,
1193 std::__promote<_A1, _A2>
1194 >::type
copysign(_A1 __lcpp_x,_A2 __lcpp_y)1195 copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT {
1196 return ::__libcpp_copysign(__lcpp_x, __lcpp_y);
1197 }
1198
1199 // erf
1200
erf(float __lcpp_x)1201 inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
erf(long double __lcpp_x)1202 inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
1203
1204 template <class _A1>
1205 inline _LIBCPP_INLINE_VISIBILITY
1206 typename std::enable_if<std::is_integral<_A1>::value, double>::type
erf(_A1 __lcpp_x)1207 erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
1208
1209 // erfc
1210
erfc(float __lcpp_x)1211 inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
erfc(long double __lcpp_x)1212 inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
1213
1214 template <class _A1>
1215 inline _LIBCPP_INLINE_VISIBILITY
1216 typename std::enable_if<std::is_integral<_A1>::value, double>::type
erfc(_A1 __lcpp_x)1217 erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
1218
1219 // exp2
1220
exp2(float __lcpp_x)1221 inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
exp2(long double __lcpp_x)1222 inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
1223
1224 template <class _A1>
1225 inline _LIBCPP_INLINE_VISIBILITY
1226 typename std::enable_if<std::is_integral<_A1>::value, double>::type
exp2(_A1 __lcpp_x)1227 exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
1228
1229 // expm1
1230
expm1(float __lcpp_x)1231 inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
expm1(long double __lcpp_x)1232 inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
1233
1234 template <class _A1>
1235 inline _LIBCPP_INLINE_VISIBILITY
1236 typename std::enable_if<std::is_integral<_A1>::value, double>::type
expm1(_A1 __lcpp_x)1237 expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
1238
1239 // fdim
1240
fdim(float __lcpp_x,float __lcpp_y)1241 inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
fdim(long double __lcpp_x,long double __lcpp_y)1242 inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
1243
1244 template <class _A1, class _A2>
1245 inline _LIBCPP_INLINE_VISIBILITY
1246 typename std::__enable_if_t
1247 <
1248 std::is_arithmetic<_A1>::value &&
1249 std::is_arithmetic<_A2>::value,
1250 std::__promote<_A1, _A2>
1251 >::type
fdim(_A1 __lcpp_x,_A2 __lcpp_y)1252 fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1253 {
1254 typedef typename std::__promote<_A1, _A2>::type __result_type;
1255 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1256 std::_IsSame<_A2, __result_type>::value)), "");
1257 return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1258 }
1259
1260 // fma
1261
fma(float __lcpp_x,float __lcpp_y,float __lcpp_z)1262 inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT
1263 {
1264 #if __has_builtin(__builtin_fmaf)
1265 return __builtin_fmaf(__lcpp_x, __lcpp_y, __lcpp_z);
1266 #else
1267 return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);
1268 #endif
1269 }
fma(long double __lcpp_x,long double __lcpp_y,long double __lcpp_z)1270 inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT
1271 {
1272 #if __has_builtin(__builtin_fmal)
1273 return __builtin_fmal(__lcpp_x, __lcpp_y, __lcpp_z);
1274 #else
1275 return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);
1276 #endif
1277 }
1278
1279 template <class _A1, class _A2, class _A3>
1280 inline _LIBCPP_INLINE_VISIBILITY
1281 typename std::__enable_if_t
1282 <
1283 std::is_arithmetic<_A1>::value &&
1284 std::is_arithmetic<_A2>::value &&
1285 std::is_arithmetic<_A3>::value,
1286 std::__promote<_A1, _A2, _A3>
1287 >::type
fma(_A1 __lcpp_x,_A2 __lcpp_y,_A3 __lcpp_z)1288 fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
1289 {
1290 typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
1291 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1292 std::_IsSame<_A2, __result_type>::value &&
1293 std::_IsSame<_A3, __result_type>::value)), "");
1294 #if __has_builtin(__builtin_fma)
1295 return __builtin_fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
1296 #else
1297 return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
1298 #endif
1299 }
1300
1301 // fmax
1302
fmax(float __lcpp_x,float __lcpp_y)1303 inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
fmax(long double __lcpp_x,long double __lcpp_y)1304 inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
1305
1306 template <class _A1, class _A2>
1307 inline _LIBCPP_INLINE_VISIBILITY
1308 typename std::__enable_if_t
1309 <
1310 std::is_arithmetic<_A1>::value &&
1311 std::is_arithmetic<_A2>::value,
1312 std::__promote<_A1, _A2>
1313 >::type
fmax(_A1 __lcpp_x,_A2 __lcpp_y)1314 fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1315 {
1316 typedef typename std::__promote<_A1, _A2>::type __result_type;
1317 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1318 std::_IsSame<_A2, __result_type>::value)), "");
1319 return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1320 }
1321
1322 // fmin
1323
fmin(float __lcpp_x,float __lcpp_y)1324 inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
fmin(long double __lcpp_x,long double __lcpp_y)1325 inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
1326
1327 template <class _A1, class _A2>
1328 inline _LIBCPP_INLINE_VISIBILITY
1329 typename std::__enable_if_t
1330 <
1331 std::is_arithmetic<_A1>::value &&
1332 std::is_arithmetic<_A2>::value,
1333 std::__promote<_A1, _A2>
1334 >::type
fmin(_A1 __lcpp_x,_A2 __lcpp_y)1335 fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1336 {
1337 typedef typename std::__promote<_A1, _A2>::type __result_type;
1338 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1339 std::_IsSame<_A2, __result_type>::value)), "");
1340 return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1341 }
1342
1343 // hypot
1344
hypot(float __lcpp_x,float __lcpp_y)1345 inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
hypot(long double __lcpp_x,long double __lcpp_y)1346 inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
1347
1348 template <class _A1, class _A2>
1349 inline _LIBCPP_INLINE_VISIBILITY
1350 typename std::__enable_if_t
1351 <
1352 std::is_arithmetic<_A1>::value &&
1353 std::is_arithmetic<_A2>::value,
1354 std::__promote<_A1, _A2>
1355 >::type
hypot(_A1 __lcpp_x,_A2 __lcpp_y)1356 hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1357 {
1358 typedef typename std::__promote<_A1, _A2>::type __result_type;
1359 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1360 std::_IsSame<_A2, __result_type>::value)), "");
1361 return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1362 }
1363
1364 // ilogb
1365
ilogb(float __lcpp_x)1366 inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
ilogb(long double __lcpp_x)1367 inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
1368
1369 template <class _A1>
1370 inline _LIBCPP_INLINE_VISIBILITY
1371 typename std::enable_if<std::is_integral<_A1>::value, int>::type
ilogb(_A1 __lcpp_x)1372 ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
1373
1374 // lgamma
1375
lgamma(float __lcpp_x)1376 inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
lgamma(long double __lcpp_x)1377 inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
1378
1379 template <class _A1>
1380 inline _LIBCPP_INLINE_VISIBILITY
1381 typename std::enable_if<std::is_integral<_A1>::value, double>::type
lgamma(_A1 __lcpp_x)1382 lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
1383
1384 // llrint
1385
llrint(float __lcpp_x)1386 inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT
1387 {
1388 #if __has_builtin(__builtin_llrintf)
1389 return __builtin_llrintf(__lcpp_x);
1390 #else
1391 return ::llrintf(__lcpp_x);
1392 #endif
1393 }
llrint(long double __lcpp_x)1394 inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT
1395 {
1396 #if __has_builtin(__builtin_llrintl)
1397 return __builtin_llrintl(__lcpp_x);
1398 #else
1399 return ::llrintl(__lcpp_x);
1400 #endif
1401 }
1402
1403 template <class _A1>
1404 inline _LIBCPP_INLINE_VISIBILITY
1405 typename std::enable_if<std::is_integral<_A1>::value, long long>::type
llrint(_A1 __lcpp_x)1406 llrint(_A1 __lcpp_x) _NOEXCEPT
1407 {
1408 #if __has_builtin(__builtin_llrint)
1409 return __builtin_llrint((double)__lcpp_x);
1410 #else
1411 return ::llrint((double)__lcpp_x);
1412 #endif
1413 }
1414
1415 // llround
1416
llround(float __lcpp_x)1417 inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT
1418 {
1419 #if __has_builtin(__builtin_llroundf)
1420 return __builtin_llroundf(__lcpp_x);
1421 #else
1422 return ::llroundf(__lcpp_x);
1423 #endif
1424 }
llround(long double __lcpp_x)1425 inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT
1426 {
1427 #if __has_builtin(__builtin_llroundl)
1428 return __builtin_llroundl(__lcpp_x);
1429 #else
1430 return ::llroundl(__lcpp_x);
1431 #endif
1432 }
1433
1434 template <class _A1>
1435 inline _LIBCPP_INLINE_VISIBILITY
1436 typename std::enable_if<std::is_integral<_A1>::value, long long>::type
llround(_A1 __lcpp_x)1437 llround(_A1 __lcpp_x) _NOEXCEPT
1438 {
1439 #if __has_builtin(__builtin_llround)
1440 return __builtin_llround((double)__lcpp_x);
1441 #else
1442 return ::llround((double)__lcpp_x);
1443 #endif
1444 }
1445
1446 // log1p
1447
log1p(float __lcpp_x)1448 inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
log1p(long double __lcpp_x)1449 inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
1450
1451 template <class _A1>
1452 inline _LIBCPP_INLINE_VISIBILITY
1453 typename std::enable_if<std::is_integral<_A1>::value, double>::type
log1p(_A1 __lcpp_x)1454 log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
1455
1456 // log2
1457
log2(float __lcpp_x)1458 inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
log2(long double __lcpp_x)1459 inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
1460
1461 template <class _A1>
1462 inline _LIBCPP_INLINE_VISIBILITY
1463 typename std::enable_if<std::is_integral<_A1>::value, double>::type
log2(_A1 __lcpp_x)1464 log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
1465
1466 // logb
1467
logb(float __lcpp_x)1468 inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
logb(long double __lcpp_x)1469 inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
1470
1471 template <class _A1>
1472 inline _LIBCPP_INLINE_VISIBILITY
1473 typename std::enable_if<std::is_integral<_A1>::value, double>::type
logb(_A1 __lcpp_x)1474 logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
1475
1476 // lrint
1477
lrint(float __lcpp_x)1478 inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT
1479 {
1480 #if __has_builtin(__builtin_lrintf)
1481 return __builtin_lrintf(__lcpp_x);
1482 #else
1483 return ::lrintf(__lcpp_x);
1484 #endif
1485 }
lrint(long double __lcpp_x)1486 inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT
1487 {
1488 #if __has_builtin(__builtin_lrintl)
1489 return __builtin_lrintl(__lcpp_x);
1490 #else
1491 return ::lrintl(__lcpp_x);
1492 #endif
1493 }
1494
1495 template <class _A1>
1496 inline _LIBCPP_INLINE_VISIBILITY
1497 typename std::enable_if<std::is_integral<_A1>::value, long>::type
lrint(_A1 __lcpp_x)1498 lrint(_A1 __lcpp_x) _NOEXCEPT
1499 {
1500 #if __has_builtin(__builtin_lrint)
1501 return __builtin_lrint((double)__lcpp_x);
1502 #else
1503 return ::lrint((double)__lcpp_x);
1504 #endif
1505 }
1506
1507 // lround
1508
lround(float __lcpp_x)1509 inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT
1510 {
1511 #if __has_builtin(__builtin_lroundf)
1512 return __builtin_lroundf(__lcpp_x);
1513 #else
1514 return ::lroundf(__lcpp_x);
1515 #endif
1516 }
lround(long double __lcpp_x)1517 inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT
1518 {
1519 #if __has_builtin(__builtin_lroundl)
1520 return __builtin_lroundl(__lcpp_x);
1521 #else
1522 return ::lroundl(__lcpp_x);
1523 #endif
1524 }
1525
1526 template <class _A1>
1527 inline _LIBCPP_INLINE_VISIBILITY
1528 typename std::enable_if<std::is_integral<_A1>::value, long>::type
lround(_A1 __lcpp_x)1529 lround(_A1 __lcpp_x) _NOEXCEPT
1530 {
1531 #if __has_builtin(__builtin_lround)
1532 return __builtin_lround((double)__lcpp_x);
1533 #else
1534 return ::lround((double)__lcpp_x);
1535 #endif
1536 }
1537
1538 // nan
1539
1540 // nearbyint
1541
nearbyint(float __lcpp_x)1542 inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
nearbyint(long double __lcpp_x)1543 inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
1544
1545 template <class _A1>
1546 inline _LIBCPP_INLINE_VISIBILITY
1547 typename std::enable_if<std::is_integral<_A1>::value, double>::type
nearbyint(_A1 __lcpp_x)1548 nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
1549
1550 // nextafter
1551
nextafter(float __lcpp_x,float __lcpp_y)1552 inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
nextafter(long double __lcpp_x,long double __lcpp_y)1553 inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
1554
1555 template <class _A1, class _A2>
1556 inline _LIBCPP_INLINE_VISIBILITY
1557 typename std::__enable_if_t
1558 <
1559 std::is_arithmetic<_A1>::value &&
1560 std::is_arithmetic<_A2>::value,
1561 std::__promote<_A1, _A2>
1562 >::type
nextafter(_A1 __lcpp_x,_A2 __lcpp_y)1563 nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1564 {
1565 typedef typename std::__promote<_A1, _A2>::type __result_type;
1566 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1567 std::_IsSame<_A2, __result_type>::value)), "");
1568 return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1569 }
1570
1571 // nexttoward
1572
nexttoward(float __lcpp_x,long double __lcpp_y)1573 inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
nexttoward(long double __lcpp_x,long double __lcpp_y)1574 inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
1575
1576 template <class _A1>
1577 inline _LIBCPP_INLINE_VISIBILITY
1578 typename std::enable_if<std::is_integral<_A1>::value, double>::type
nexttoward(_A1 __lcpp_x,long double __lcpp_y)1579 nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
1580
1581 // remainder
1582
remainder(float __lcpp_x,float __lcpp_y)1583 inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
remainder(long double __lcpp_x,long double __lcpp_y)1584 inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
1585
1586 template <class _A1, class _A2>
1587 inline _LIBCPP_INLINE_VISIBILITY
1588 typename std::__enable_if_t
1589 <
1590 std::is_arithmetic<_A1>::value &&
1591 std::is_arithmetic<_A2>::value,
1592 std::__promote<_A1, _A2>
1593 >::type
remainder(_A1 __lcpp_x,_A2 __lcpp_y)1594 remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
1595 {
1596 typedef typename std::__promote<_A1, _A2>::type __result_type;
1597 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1598 std::_IsSame<_A2, __result_type>::value)), "");
1599 return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
1600 }
1601
1602 // remquo
1603
remquo(float __lcpp_x,float __lcpp_y,int * __lcpp_z)1604 inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
remquo(long double __lcpp_x,long double __lcpp_y,int * __lcpp_z)1605 inline _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);}
1606
1607 template <class _A1, class _A2>
1608 inline _LIBCPP_INLINE_VISIBILITY
1609 typename std::__enable_if_t
1610 <
1611 std::is_arithmetic<_A1>::value &&
1612 std::is_arithmetic<_A2>::value,
1613 std::__promote<_A1, _A2>
1614 >::type
remquo(_A1 __lcpp_x,_A2 __lcpp_y,int * __lcpp_z)1615 remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
1616 {
1617 typedef typename std::__promote<_A1, _A2>::type __result_type;
1618 static_assert((!(std::_IsSame<_A1, __result_type>::value &&
1619 std::_IsSame<_A2, __result_type>::value)), "");
1620 return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
1621 }
1622
1623 // rint
1624
rint(float __lcpp_x)1625 inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT
1626 {
1627 #if __has_builtin(__builtin_rintf)
1628 return __builtin_rintf(__lcpp_x);
1629 #else
1630 return ::rintf(__lcpp_x);
1631 #endif
1632 }
rint(long double __lcpp_x)1633 inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT
1634 {
1635 #if __has_builtin(__builtin_rintl)
1636 return __builtin_rintl(__lcpp_x);
1637 #else
1638 return ::rintl(__lcpp_x);
1639 #endif
1640 }
1641
1642 template <class _A1>
1643 inline _LIBCPP_INLINE_VISIBILITY
1644 typename std::enable_if<std::is_integral<_A1>::value, double>::type
rint(_A1 __lcpp_x)1645 rint(_A1 __lcpp_x) _NOEXCEPT
1646 {
1647 #if __has_builtin(__builtin_rint)
1648 return __builtin_rint((double)__lcpp_x);
1649 #else
1650 return ::rint((double)__lcpp_x);
1651 #endif
1652 }
1653
1654 // round
1655
round(float __lcpp_x)1656 inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT
1657 {
1658 #if __has_builtin(__builtin_round)
1659 return __builtin_round(__lcpp_x);
1660 #else
1661 return ::round(__lcpp_x);
1662 #endif
1663 }
round(long double __lcpp_x)1664 inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT
1665 {
1666 #if __has_builtin(__builtin_roundl)
1667 return __builtin_roundl(__lcpp_x);
1668 #else
1669 return ::roundl(__lcpp_x);
1670 #endif
1671 }
1672
1673 template <class _A1>
1674 inline _LIBCPP_INLINE_VISIBILITY
1675 typename std::enable_if<std::is_integral<_A1>::value, double>::type
round(_A1 __lcpp_x)1676 round(_A1 __lcpp_x) _NOEXCEPT
1677 {
1678 #if __has_builtin(__builtin_round)
1679 return __builtin_round((double)__lcpp_x);
1680 #else
1681 return ::round((double)__lcpp_x);
1682 #endif
1683 }
1684
1685 // scalbln
1686
scalbln(float __lcpp_x,long __lcpp_y)1687 inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
scalbln(long double __lcpp_x,long __lcpp_y)1688 inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
1689
1690 template <class _A1>
1691 inline _LIBCPP_INLINE_VISIBILITY
1692 typename std::enable_if<std::is_integral<_A1>::value, double>::type
scalbln(_A1 __lcpp_x,long __lcpp_y)1693 scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
1694
1695 // scalbn
1696
scalbn(float __lcpp_x,int __lcpp_y)1697 inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
scalbn(long double __lcpp_x,int __lcpp_y)1698 inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
1699
1700 template <class _A1>
1701 inline _LIBCPP_INLINE_VISIBILITY
1702 typename std::enable_if<std::is_integral<_A1>::value, double>::type
scalbn(_A1 __lcpp_x,int __lcpp_y)1703 scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
1704
1705 // tgamma
1706
tgamma(float __lcpp_x)1707 inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
tgamma(long double __lcpp_x)1708 inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
1709
1710 template <class _A1>
1711 inline _LIBCPP_INLINE_VISIBILITY
1712 typename std::enable_if<std::is_integral<_A1>::value, double>::type
tgamma(_A1 __lcpp_x)1713 tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
1714
1715 // trunc
1716
trunc(float __lcpp_x)1717 inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT
1718 {
1719 #if __has_builtin(__builtin_trunc)
1720 return __builtin_trunc(__lcpp_x);
1721 #else
1722 return ::trunc(__lcpp_x);
1723 #endif
1724 }
trunc(long double __lcpp_x)1725 inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT
1726 {
1727 #if __has_builtin(__builtin_truncl)
1728 return __builtin_truncl(__lcpp_x);
1729 #else
1730 return ::truncl(__lcpp_x);
1731 #endif
1732 }
1733
1734 template <class _A1>
1735 inline _LIBCPP_INLINE_VISIBILITY
1736 typename std::enable_if<std::is_integral<_A1>::value, double>::type
trunc(_A1 __lcpp_x)1737 trunc(_A1 __lcpp_x) _NOEXCEPT
1738 {
1739 #if __has_builtin(__builtin_trunc)
1740 return __builtin_trunc((double)__lcpp_x);
1741 #else
1742 return ::trunc((double)__lcpp_x);
1743 #endif
1744 }
1745
1746 } // extern "C++"
1747
1748 #endif // __cplusplus
1749
1750 #else // _LIBCPP_MATH_H
1751
1752 // This include lives outside the header guard in order to support an MSVC
1753 // extension which allows users to do:
1754 //
1755 // #define _USE_MATH_DEFINES
1756 // #include <math.h>
1757 //
1758 // and receive the definitions of mathematical constants, even if <math.h>
1759 // has previously been included.
1760 #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES)
1761 #include_next <math.h>
1762 #endif
1763
1764 #endif // _LIBCPP_MATH_H
1765