1 | // -*- C++ -*- |
2 | //===---------------------------- math.h ----------------------------------===// |
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 | #define _LIBCPP_STDLIB_INCLUDE_NEXT |
301 | #include <stdlib.h> |
302 | |
303 | #include_next <math.h> |
304 | |
305 | #ifdef __cplusplus |
306 | |
307 | // We support including .h headers inside 'extern "C"' contexts, so switch |
308 | // back to C++ linkage before including these C++ headers. |
309 | extern "C++" { |
310 | |
311 | #include <type_traits> |
312 | #include <limits> |
313 | |
314 | // signbit |
315 | |
316 | #ifdef signbit |
317 | |
318 | template <class _A1> |
319 | _LIBCPP_INLINE_VISIBILITY |
320 | bool |
321 | __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT |
322 | { |
323 | return signbit(__lcpp_x); |
324 | } |
325 | |
326 | #undef signbit |
327 | |
328 | template <class _A1> |
329 | inline _LIBCPP_INLINE_VISIBILITY |
330 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type |
331 | signbit(_A1 __lcpp_x) _NOEXCEPT |
332 | { |
333 | return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); |
334 | } |
335 | |
336 | template <class _A1> |
337 | inline _LIBCPP_INLINE_VISIBILITY |
338 | typename std::enable_if< |
339 | std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type |
340 | signbit(_A1 __lcpp_x) _NOEXCEPT |
341 | { return __lcpp_x < 0; } |
342 | |
343 | template <class _A1> |
344 | inline _LIBCPP_INLINE_VISIBILITY |
345 | typename std::enable_if< |
346 | std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type |
347 | signbit(_A1) _NOEXCEPT |
348 | { return false; } |
349 | |
350 | #elif defined(_LIBCPP_MSVCRT) |
351 | |
352 | template <typename _A1> |
353 | inline _LIBCPP_INLINE_VISIBILITY |
354 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type |
355 | signbit(_A1 __lcpp_x) _NOEXCEPT |
356 | { |
357 | return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); |
358 | } |
359 | |
360 | template <class _A1> |
361 | inline _LIBCPP_INLINE_VISIBILITY |
362 | typename std::enable_if< |
363 | std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type |
364 | signbit(_A1 __lcpp_x) _NOEXCEPT |
365 | { return __lcpp_x < 0; } |
366 | |
367 | template <class _A1> |
368 | inline _LIBCPP_INLINE_VISIBILITY |
369 | typename std::enable_if< |
370 | std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type |
371 | signbit(_A1) _NOEXCEPT |
372 | { return false; } |
373 | |
374 | #endif // signbit |
375 | |
376 | // fpclassify |
377 | |
378 | #ifdef fpclassify |
379 | |
380 | template <class _A1> |
381 | _LIBCPP_INLINE_VISIBILITY |
382 | int |
383 | __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT |
384 | { |
385 | return fpclassify(__lcpp_x); |
386 | } |
387 | |
388 | #undef fpclassify |
389 | |
390 | template <class _A1> |
391 | inline _LIBCPP_INLINE_VISIBILITY |
392 | typename std::enable_if<std::is_floating_point<_A1>::value, int>::type |
393 | fpclassify(_A1 __lcpp_x) _NOEXCEPT |
394 | { |
395 | return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); |
396 | } |
397 | |
398 | template <class _A1> |
399 | inline _LIBCPP_INLINE_VISIBILITY |
400 | typename std::enable_if<std::is_integral<_A1>::value, int>::type |
401 | fpclassify(_A1 __lcpp_x) _NOEXCEPT |
402 | { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } |
403 | |
404 | #elif defined(_LIBCPP_MSVCRT) |
405 | |
406 | template <typename _A1> |
407 | inline _LIBCPP_INLINE_VISIBILITY |
408 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type |
409 | fpclassify(_A1 __lcpp_x) _NOEXCEPT |
410 | { |
411 | return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); |
412 | } |
413 | |
414 | template <class _A1> |
415 | inline _LIBCPP_INLINE_VISIBILITY |
416 | typename std::enable_if<std::is_integral<_A1>::value, int>::type |
417 | fpclassify(_A1 __lcpp_x) _NOEXCEPT |
418 | { return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } |
419 | |
420 | #endif // fpclassify |
421 | |
422 | // isfinite |
423 | |
424 | #ifdef isfinite |
425 | |
426 | template <class _A1> |
427 | _LIBCPP_INLINE_VISIBILITY |
428 | bool |
429 | __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT |
430 | { |
431 | return isfinite(__lcpp_x); |
432 | } |
433 | |
434 | #undef isfinite |
435 | |
436 | template <class _A1> |
437 | inline _LIBCPP_INLINE_VISIBILITY |
438 | typename std::enable_if< |
439 | std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, |
440 | bool>::type |
441 | isfinite(_A1 __lcpp_x) _NOEXCEPT |
442 | { |
443 | return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); |
444 | } |
445 | |
446 | template <class _A1> |
447 | inline _LIBCPP_INLINE_VISIBILITY |
448 | typename std::enable_if< |
449 | std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, |
450 | bool>::type |
451 | isfinite(_A1) _NOEXCEPT |
452 | { return true; } |
453 | |
454 | #endif // isfinite |
455 | |
456 | // isinf |
457 | |
458 | #ifdef isinf |
459 | |
460 | template <class _A1> |
461 | _LIBCPP_INLINE_VISIBILITY |
462 | bool |
463 | __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT |
464 | { |
465 | return isinf(__lcpp_x); |
466 | } |
467 | |
468 | #undef isinf |
469 | |
470 | template <class _A1> |
471 | inline _LIBCPP_INLINE_VISIBILITY |
472 | typename std::enable_if< |
473 | std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, |
474 | bool>::type |
475 | isinf(_A1 __lcpp_x) _NOEXCEPT |
476 | { |
477 | return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); |
478 | } |
479 | |
480 | template <class _A1> |
481 | inline _LIBCPP_INLINE_VISIBILITY |
482 | typename std::enable_if< |
483 | std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, |
484 | bool>::type |
485 | isinf(_A1) _NOEXCEPT |
486 | { return false; } |
487 | |
488 | #ifdef _LIBCPP_PREFERRED_OVERLOAD |
489 | inline _LIBCPP_INLINE_VISIBILITY |
490 | bool |
491 | isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } |
492 | |
493 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD |
494 | bool |
495 | isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } |
496 | |
497 | inline _LIBCPP_INLINE_VISIBILITY |
498 | bool |
499 | isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } |
500 | #endif |
501 | |
502 | #endif // isinf |
503 | |
504 | // isnan |
505 | |
506 | #ifdef isnan |
507 | |
508 | template <class _A1> |
509 | _LIBCPP_INLINE_VISIBILITY |
510 | bool |
511 | __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT |
512 | { |
513 | #if __has_builtin(__builtin_isnan) |
514 | return __builtin_isnan(__lcpp_x); |
515 | #else |
516 | return isnan(__lcpp_x); |
517 | #endif |
518 | } |
519 | |
520 | #undef isnan |
521 | |
522 | template <class _A1> |
523 | inline _LIBCPP_INLINE_VISIBILITY |
524 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type |
525 | isnan(_A1 __lcpp_x) _NOEXCEPT |
526 | { |
527 | return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); |
528 | } |
529 | |
530 | template <class _A1> |
531 | inline _LIBCPP_INLINE_VISIBILITY |
532 | typename std::enable_if<std::is_integral<_A1>::value, bool>::type |
533 | isnan(_A1) _NOEXCEPT |
534 | { return false; } |
535 | |
536 | #ifdef _LIBCPP_PREFERRED_OVERLOAD |
537 | inline _LIBCPP_INLINE_VISIBILITY |
538 | bool |
539 | isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } |
540 | |
541 | inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD |
542 | bool |
543 | isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } |
544 | |
545 | inline _LIBCPP_INLINE_VISIBILITY |
546 | bool |
547 | isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } |
548 | #endif |
549 | |
550 | #endif // isnan |
551 | |
552 | // isnormal |
553 | |
554 | #ifdef isnormal |
555 | |
556 | template <class _A1> |
557 | _LIBCPP_INLINE_VISIBILITY |
558 | bool |
559 | __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT |
560 | { |
561 | return isnormal(__lcpp_x); |
562 | } |
563 | |
564 | #undef isnormal |
565 | |
566 | template <class _A1> |
567 | inline _LIBCPP_INLINE_VISIBILITY |
568 | typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type |
569 | isnormal(_A1 __lcpp_x) _NOEXCEPT |
570 | { |
571 | return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); |
572 | } |
573 | |
574 | template <class _A1> |
575 | inline _LIBCPP_INLINE_VISIBILITY |
576 | typename std::enable_if<std::is_integral<_A1>::value, bool>::type |
577 | isnormal(_A1 __lcpp_x) _NOEXCEPT |
578 | { return __lcpp_x != 0; } |
579 | |
580 | #endif // isnormal |
581 | |
582 | // isgreater |
583 | |
584 | #ifdef isgreater |
585 | |
586 | template <class _A1, class _A2> |
587 | _LIBCPP_INLINE_VISIBILITY |
588 | bool |
589 | __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
590 | { |
591 | return isgreater(__lcpp_x, __lcpp_y); |
592 | } |
593 | |
594 | #undef isgreater |
595 | |
596 | template <class _A1, class _A2> |
597 | inline _LIBCPP_INLINE_VISIBILITY |
598 | typename std::enable_if |
599 | < |
600 | std::is_arithmetic<_A1>::value && |
601 | std::is_arithmetic<_A2>::value, |
602 | bool |
603 | >::type |
604 | isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
605 | { |
606 | typedef typename std::__promote<_A1, _A2>::type type; |
607 | return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); |
608 | } |
609 | |
610 | #endif // isgreater |
611 | |
612 | // isgreaterequal |
613 | |
614 | #ifdef isgreaterequal |
615 | |
616 | template <class _A1, class _A2> |
617 | _LIBCPP_INLINE_VISIBILITY |
618 | bool |
619 | __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
620 | { |
621 | return isgreaterequal(__lcpp_x, __lcpp_y); |
622 | } |
623 | |
624 | #undef isgreaterequal |
625 | |
626 | template <class _A1, class _A2> |
627 | inline _LIBCPP_INLINE_VISIBILITY |
628 | typename std::enable_if |
629 | < |
630 | std::is_arithmetic<_A1>::value && |
631 | std::is_arithmetic<_A2>::value, |
632 | bool |
633 | >::type |
634 | isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
635 | { |
636 | typedef typename std::__promote<_A1, _A2>::type type; |
637 | return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); |
638 | } |
639 | |
640 | #endif // isgreaterequal |
641 | |
642 | // isless |
643 | |
644 | #ifdef isless |
645 | |
646 | template <class _A1, class _A2> |
647 | _LIBCPP_INLINE_VISIBILITY |
648 | bool |
649 | __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
650 | { |
651 | return isless(__lcpp_x, __lcpp_y); |
652 | } |
653 | |
654 | #undef isless |
655 | |
656 | template <class _A1, class _A2> |
657 | inline _LIBCPP_INLINE_VISIBILITY |
658 | typename std::enable_if |
659 | < |
660 | std::is_arithmetic<_A1>::value && |
661 | std::is_arithmetic<_A2>::value, |
662 | bool |
663 | >::type |
664 | isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
665 | { |
666 | typedef typename std::__promote<_A1, _A2>::type type; |
667 | return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); |
668 | } |
669 | |
670 | #endif // isless |
671 | |
672 | // islessequal |
673 | |
674 | #ifdef islessequal |
675 | |
676 | template <class _A1, class _A2> |
677 | _LIBCPP_INLINE_VISIBILITY |
678 | bool |
679 | __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
680 | { |
681 | return islessequal(__lcpp_x, __lcpp_y); |
682 | } |
683 | |
684 | #undef islessequal |
685 | |
686 | template <class _A1, class _A2> |
687 | inline _LIBCPP_INLINE_VISIBILITY |
688 | typename std::enable_if |
689 | < |
690 | std::is_arithmetic<_A1>::value && |
691 | std::is_arithmetic<_A2>::value, |
692 | bool |
693 | >::type |
694 | islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
695 | { |
696 | typedef typename std::__promote<_A1, _A2>::type type; |
697 | return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); |
698 | } |
699 | |
700 | #endif // islessequal |
701 | |
702 | // islessgreater |
703 | |
704 | #ifdef islessgreater |
705 | |
706 | template <class _A1, class _A2> |
707 | _LIBCPP_INLINE_VISIBILITY |
708 | bool |
709 | __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
710 | { |
711 | return islessgreater(__lcpp_x, __lcpp_y); |
712 | } |
713 | |
714 | #undef islessgreater |
715 | |
716 | template <class _A1, class _A2> |
717 | inline _LIBCPP_INLINE_VISIBILITY |
718 | typename std::enable_if |
719 | < |
720 | std::is_arithmetic<_A1>::value && |
721 | std::is_arithmetic<_A2>::value, |
722 | bool |
723 | >::type |
724 | islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
725 | { |
726 | typedef typename std::__promote<_A1, _A2>::type type; |
727 | return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); |
728 | } |
729 | |
730 | #endif // islessgreater |
731 | |
732 | // isunordered |
733 | |
734 | #ifdef isunordered |
735 | |
736 | template <class _A1, class _A2> |
737 | _LIBCPP_INLINE_VISIBILITY |
738 | bool |
739 | __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
740 | { |
741 | return isunordered(__lcpp_x, __lcpp_y); |
742 | } |
743 | |
744 | #undef isunordered |
745 | |
746 | template <class _A1, class _A2> |
747 | inline _LIBCPP_INLINE_VISIBILITY |
748 | typename std::enable_if |
749 | < |
750 | std::is_arithmetic<_A1>::value && |
751 | std::is_arithmetic<_A2>::value, |
752 | bool |
753 | >::type |
754 | isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
755 | { |
756 | typedef typename std::__promote<_A1, _A2>::type type; |
757 | return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); |
758 | } |
759 | |
760 | #endif // isunordered |
761 | |
762 | // abs |
763 | |
764 | #undef abs |
765 | #undef labs |
766 | #ifndef _LIBCPP_HAS_NO_LONG_LONG |
767 | #undef llabs |
768 | #endif |
769 | |
770 | // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined |
771 | #if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX) |
772 | inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { |
773 | return ::labs(__x); |
774 | } |
775 | #ifndef _LIBCPP_HAS_NO_LONG_LONG |
776 | inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { |
777 | return ::llabs(__x); |
778 | } |
779 | #endif // _LIBCPP_HAS_NO_LONG_LONG |
780 | #endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX) |
781 | |
782 | |
783 | #if !(defined(_AIX) || defined(__sun__)) |
784 | inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { |
785 | return ::fabsf(__lcpp_x); |
786 | } |
787 | |
788 | inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { |
789 | return ::fabs(__lcpp_x); |
790 | } |
791 | |
792 | inline _LIBCPP_INLINE_VISIBILITY long double |
793 | abs(long double __lcpp_x) _NOEXCEPT { |
794 | return ::fabsl(__lcpp_x); |
795 | } |
796 | #endif // !(defined(_AIX) || defined(__sun__)) |
797 | |
798 | // div |
799 | |
800 | #undef div |
801 | #undef ldiv |
802 | #ifndef _LIBCPP_HAS_NO_LONG_LONG |
803 | #undef lldiv |
804 | #endif |
805 | |
806 | // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined |
807 | #if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX) |
808 | inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT { |
809 | return ::ldiv(__x, __y); |
810 | } |
811 | #ifndef _LIBCPP_HAS_NO_LONG_LONG |
812 | inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, |
813 | long long __y) _NOEXCEPT { |
814 | return ::lldiv(__x, __y); |
815 | } |
816 | #endif // _LIBCPP_HAS_NO_LONG_LONG |
817 | #endif // _LIBCPP_MSVCRT / __sun__ / _AIX |
818 | |
819 | // acos |
820 | |
821 | #if !(defined(_AIX) || defined(__sun__)) |
822 | inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} |
823 | inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} |
824 | #endif |
825 | |
826 | template <class _A1> |
827 | inline _LIBCPP_INLINE_VISIBILITY |
828 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
829 | acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);} |
830 | |
831 | // asin |
832 | |
833 | #if !(defined(_AIX) || defined(__sun__)) |
834 | inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} |
835 | inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} |
836 | #endif |
837 | |
838 | template <class _A1> |
839 | inline _LIBCPP_INLINE_VISIBILITY |
840 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
841 | asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);} |
842 | |
843 | // atan |
844 | |
845 | #if !(defined(_AIX) || defined(__sun__)) |
846 | inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);} |
847 | inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);} |
848 | #endif |
849 | |
850 | template <class _A1> |
851 | inline _LIBCPP_INLINE_VISIBILITY |
852 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
853 | atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);} |
854 | |
855 | // atan2 |
856 | |
857 | #if !(defined(_AIX) || defined(__sun__)) |
858 | inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);} |
859 | inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);} |
860 | #endif |
861 | |
862 | template <class _A1, class _A2> |
863 | inline _LIBCPP_INLINE_VISIBILITY |
864 | typename std::_EnableIf |
865 | < |
866 | std::is_arithmetic<_A1>::value && |
867 | std::is_arithmetic<_A2>::value, |
868 | std::__promote<_A1, _A2> |
869 | >::type |
870 | atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT |
871 | { |
872 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
873 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
874 | std::_IsSame<_A2, __result_type>::value)), "" ); |
875 | return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); |
876 | } |
877 | |
878 | // ceil |
879 | |
880 | #if !(defined(_AIX) || defined(__sun__)) |
881 | inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);} |
882 | inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);} |
883 | #endif |
884 | |
885 | template <class _A1> |
886 | inline _LIBCPP_INLINE_VISIBILITY |
887 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
888 | ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);} |
889 | |
890 | // cos |
891 | |
892 | #if !(defined(_AIX) || defined(__sun__)) |
893 | inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);} |
894 | inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);} |
895 | #endif |
896 | |
897 | template <class _A1> |
898 | inline _LIBCPP_INLINE_VISIBILITY |
899 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
900 | cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);} |
901 | |
902 | // cosh |
903 | |
904 | #if !(defined(_AIX) || defined(__sun__)) |
905 | inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);} |
906 | inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);} |
907 | #endif |
908 | |
909 | template <class _A1> |
910 | inline _LIBCPP_INLINE_VISIBILITY |
911 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
912 | cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);} |
913 | |
914 | // exp |
915 | |
916 | #if !(defined(_AIX) || defined(__sun__)) |
917 | inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);} |
918 | inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);} |
919 | #endif |
920 | |
921 | template <class _A1> |
922 | inline _LIBCPP_INLINE_VISIBILITY |
923 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
924 | exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);} |
925 | |
926 | // fabs |
927 | |
928 | #if !(defined(_AIX) || defined(__sun__)) |
929 | inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);} |
930 | inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} |
931 | #endif |
932 | |
933 | template <class _A1> |
934 | inline _LIBCPP_INLINE_VISIBILITY |
935 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
936 | fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);} |
937 | |
938 | // floor |
939 | |
940 | #if !(defined(_AIX) || defined(__sun__)) |
941 | inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);} |
942 | inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);} |
943 | #endif |
944 | |
945 | template <class _A1> |
946 | inline _LIBCPP_INLINE_VISIBILITY |
947 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
948 | floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);} |
949 | |
950 | // fmod |
951 | |
952 | #if !(defined(_AIX) || defined(__sun__)) |
953 | inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);} |
954 | inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);} |
955 | #endif |
956 | |
957 | template <class _A1, class _A2> |
958 | inline _LIBCPP_INLINE_VISIBILITY |
959 | typename std::_EnableIf |
960 | < |
961 | std::is_arithmetic<_A1>::value && |
962 | std::is_arithmetic<_A2>::value, |
963 | std::__promote<_A1, _A2> |
964 | >::type |
965 | fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
966 | { |
967 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
968 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
969 | std::_IsSame<_A2, __result_type>::value)), "" ); |
970 | return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
971 | } |
972 | |
973 | // frexp |
974 | |
975 | #if !(defined(_AIX) || defined(__sun__)) |
976 | inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);} |
977 | inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);} |
978 | #endif |
979 | |
980 | template <class _A1> |
981 | inline _LIBCPP_INLINE_VISIBILITY |
982 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
983 | frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);} |
984 | |
985 | // ldexp |
986 | |
987 | #if !(defined(_AIX) || defined(__sun__)) |
988 | inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);} |
989 | inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);} |
990 | #endif |
991 | |
992 | template <class _A1> |
993 | inline _LIBCPP_INLINE_VISIBILITY |
994 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
995 | ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);} |
996 | |
997 | // log |
998 | |
999 | #if !(defined(_AIX) || defined(__sun__)) |
1000 | inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);} |
1001 | inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);} |
1002 | #endif |
1003 | |
1004 | template <class _A1> |
1005 | inline _LIBCPP_INLINE_VISIBILITY |
1006 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1007 | log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);} |
1008 | |
1009 | // log10 |
1010 | |
1011 | #if !(defined(_AIX) || defined(__sun__)) |
1012 | inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);} |
1013 | inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);} |
1014 | #endif |
1015 | |
1016 | template <class _A1> |
1017 | inline _LIBCPP_INLINE_VISIBILITY |
1018 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1019 | log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);} |
1020 | |
1021 | // modf |
1022 | |
1023 | #if !(defined(_AIX) || defined(__sun__)) |
1024 | inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);} |
1025 | inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);} |
1026 | #endif |
1027 | |
1028 | // pow |
1029 | |
1030 | #if !(defined(_AIX) || defined(__sun__)) |
1031 | inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);} |
1032 | inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);} |
1033 | #endif |
1034 | |
1035 | template <class _A1, class _A2> |
1036 | inline _LIBCPP_INLINE_VISIBILITY |
1037 | typename std::_EnableIf |
1038 | < |
1039 | std::is_arithmetic<_A1>::value && |
1040 | std::is_arithmetic<_A2>::value, |
1041 | std::__promote<_A1, _A2> |
1042 | >::type |
1043 | pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1044 | { |
1045 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1046 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1047 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1048 | return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1049 | } |
1050 | |
1051 | // sin |
1052 | |
1053 | #if !(defined(_AIX) || defined(__sun__)) |
1054 | inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);} |
1055 | inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);} |
1056 | #endif |
1057 | |
1058 | template <class _A1> |
1059 | inline _LIBCPP_INLINE_VISIBILITY |
1060 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1061 | sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);} |
1062 | |
1063 | // sinh |
1064 | |
1065 | #if !(defined(_AIX) || defined(__sun__)) |
1066 | inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);} |
1067 | inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);} |
1068 | #endif |
1069 | |
1070 | template <class _A1> |
1071 | inline _LIBCPP_INLINE_VISIBILITY |
1072 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1073 | sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);} |
1074 | |
1075 | // sqrt |
1076 | |
1077 | #if !(defined(_AIX) || defined(__sun__)) |
1078 | inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);} |
1079 | inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);} |
1080 | #endif |
1081 | |
1082 | template <class _A1> |
1083 | inline _LIBCPP_INLINE_VISIBILITY |
1084 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1085 | sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);} |
1086 | |
1087 | // tan |
1088 | |
1089 | #if !(defined(_AIX) || defined(__sun__)) |
1090 | inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);} |
1091 | inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);} |
1092 | #endif |
1093 | |
1094 | template <class _A1> |
1095 | inline _LIBCPP_INLINE_VISIBILITY |
1096 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1097 | tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);} |
1098 | |
1099 | // tanh |
1100 | |
1101 | #if !(defined(_AIX) || defined(__sun__)) |
1102 | inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);} |
1103 | inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);} |
1104 | #endif |
1105 | |
1106 | template <class _A1> |
1107 | inline _LIBCPP_INLINE_VISIBILITY |
1108 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1109 | tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);} |
1110 | |
1111 | // acosh |
1112 | |
1113 | inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);} |
1114 | inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);} |
1115 | |
1116 | template <class _A1> |
1117 | inline _LIBCPP_INLINE_VISIBILITY |
1118 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1119 | acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);} |
1120 | |
1121 | // asinh |
1122 | |
1123 | inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);} |
1124 | inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);} |
1125 | |
1126 | template <class _A1> |
1127 | inline _LIBCPP_INLINE_VISIBILITY |
1128 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1129 | asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);} |
1130 | |
1131 | // atanh |
1132 | |
1133 | inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);} |
1134 | inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);} |
1135 | |
1136 | template <class _A1> |
1137 | inline _LIBCPP_INLINE_VISIBILITY |
1138 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1139 | atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);} |
1140 | |
1141 | // cbrt |
1142 | |
1143 | inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);} |
1144 | inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);} |
1145 | |
1146 | template <class _A1> |
1147 | inline _LIBCPP_INLINE_VISIBILITY |
1148 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1149 | cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);} |
1150 | |
1151 | // copysign |
1152 | |
1153 | inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, |
1154 | float __lcpp_y) _NOEXCEPT { |
1155 | return ::copysignf(__lcpp_x, __lcpp_y); |
1156 | } |
1157 | inline _LIBCPP_INLINE_VISIBILITY long double |
1158 | copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { |
1159 | return ::copysignl(__lcpp_x, __lcpp_y); |
1160 | } |
1161 | |
1162 | template <class _A1, class _A2> |
1163 | inline _LIBCPP_INLINE_VISIBILITY |
1164 | typename std::_EnableIf |
1165 | < |
1166 | std::is_arithmetic<_A1>::value && |
1167 | std::is_arithmetic<_A2>::value, |
1168 | std::__promote<_A1, _A2> |
1169 | >::type |
1170 | copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1171 | { |
1172 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1173 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1174 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1175 | return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1176 | } |
1177 | |
1178 | // erf |
1179 | |
1180 | inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);} |
1181 | inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);} |
1182 | |
1183 | template <class _A1> |
1184 | inline _LIBCPP_INLINE_VISIBILITY |
1185 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1186 | erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);} |
1187 | |
1188 | // erfc |
1189 | |
1190 | inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);} |
1191 | inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);} |
1192 | |
1193 | template <class _A1> |
1194 | inline _LIBCPP_INLINE_VISIBILITY |
1195 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1196 | erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);} |
1197 | |
1198 | // exp2 |
1199 | |
1200 | inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);} |
1201 | inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);} |
1202 | |
1203 | template <class _A1> |
1204 | inline _LIBCPP_INLINE_VISIBILITY |
1205 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1206 | exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);} |
1207 | |
1208 | // expm1 |
1209 | |
1210 | inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);} |
1211 | inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);} |
1212 | |
1213 | template <class _A1> |
1214 | inline _LIBCPP_INLINE_VISIBILITY |
1215 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1216 | expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);} |
1217 | |
1218 | // fdim |
1219 | |
1220 | inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);} |
1221 | inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);} |
1222 | |
1223 | template <class _A1, class _A2> |
1224 | inline _LIBCPP_INLINE_VISIBILITY |
1225 | typename std::_EnableIf |
1226 | < |
1227 | std::is_arithmetic<_A1>::value && |
1228 | std::is_arithmetic<_A2>::value, |
1229 | std::__promote<_A1, _A2> |
1230 | >::type |
1231 | fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1232 | { |
1233 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1234 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1235 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1236 | return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1237 | } |
1238 | |
1239 | // fma |
1240 | |
1241 | inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);} |
1242 | inline _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);} |
1243 | |
1244 | template <class _A1, class _A2, class _A3> |
1245 | inline _LIBCPP_INLINE_VISIBILITY |
1246 | typename std::_EnableIf |
1247 | < |
1248 | std::is_arithmetic<_A1>::value && |
1249 | std::is_arithmetic<_A2>::value && |
1250 | std::is_arithmetic<_A3>::value, |
1251 | std::__promote<_A1, _A2, _A3> |
1252 | >::type |
1253 | fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT |
1254 | { |
1255 | typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; |
1256 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1257 | std::_IsSame<_A2, __result_type>::value && |
1258 | std::_IsSame<_A3, __result_type>::value)), "" ); |
1259 | return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); |
1260 | } |
1261 | |
1262 | // fmax |
1263 | |
1264 | inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);} |
1265 | inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);} |
1266 | |
1267 | template <class _A1, class _A2> |
1268 | inline _LIBCPP_INLINE_VISIBILITY |
1269 | typename std::_EnableIf |
1270 | < |
1271 | std::is_arithmetic<_A1>::value && |
1272 | std::is_arithmetic<_A2>::value, |
1273 | std::__promote<_A1, _A2> |
1274 | >::type |
1275 | fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1276 | { |
1277 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1278 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1279 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1280 | return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1281 | } |
1282 | |
1283 | // fmin |
1284 | |
1285 | inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);} |
1286 | inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);} |
1287 | |
1288 | template <class _A1, class _A2> |
1289 | inline _LIBCPP_INLINE_VISIBILITY |
1290 | typename std::_EnableIf |
1291 | < |
1292 | std::is_arithmetic<_A1>::value && |
1293 | std::is_arithmetic<_A2>::value, |
1294 | std::__promote<_A1, _A2> |
1295 | >::type |
1296 | fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1297 | { |
1298 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1299 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1300 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1301 | return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1302 | } |
1303 | |
1304 | // hypot |
1305 | |
1306 | inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);} |
1307 | inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);} |
1308 | |
1309 | template <class _A1, class _A2> |
1310 | inline _LIBCPP_INLINE_VISIBILITY |
1311 | typename std::_EnableIf |
1312 | < |
1313 | std::is_arithmetic<_A1>::value && |
1314 | std::is_arithmetic<_A2>::value, |
1315 | std::__promote<_A1, _A2> |
1316 | >::type |
1317 | hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1318 | { |
1319 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1320 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1321 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1322 | return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1323 | } |
1324 | |
1325 | // ilogb |
1326 | |
1327 | inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);} |
1328 | inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);} |
1329 | |
1330 | template <class _A1> |
1331 | inline _LIBCPP_INLINE_VISIBILITY |
1332 | typename std::enable_if<std::is_integral<_A1>::value, int>::type |
1333 | ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);} |
1334 | |
1335 | // lgamma |
1336 | |
1337 | inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);} |
1338 | inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);} |
1339 | |
1340 | template <class _A1> |
1341 | inline _LIBCPP_INLINE_VISIBILITY |
1342 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1343 | lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);} |
1344 | |
1345 | // llrint |
1346 | |
1347 | inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);} |
1348 | inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);} |
1349 | |
1350 | template <class _A1> |
1351 | inline _LIBCPP_INLINE_VISIBILITY |
1352 | typename std::enable_if<std::is_integral<_A1>::value, long long>::type |
1353 | llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);} |
1354 | |
1355 | // llround |
1356 | |
1357 | inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);} |
1358 | inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);} |
1359 | |
1360 | template <class _A1> |
1361 | inline _LIBCPP_INLINE_VISIBILITY |
1362 | typename std::enable_if<std::is_integral<_A1>::value, long long>::type |
1363 | llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);} |
1364 | |
1365 | // log1p |
1366 | |
1367 | inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);} |
1368 | inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);} |
1369 | |
1370 | template <class _A1> |
1371 | inline _LIBCPP_INLINE_VISIBILITY |
1372 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1373 | log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);} |
1374 | |
1375 | // log2 |
1376 | |
1377 | inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);} |
1378 | inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);} |
1379 | |
1380 | template <class _A1> |
1381 | inline _LIBCPP_INLINE_VISIBILITY |
1382 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1383 | log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);} |
1384 | |
1385 | // logb |
1386 | |
1387 | inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);} |
1388 | inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);} |
1389 | |
1390 | template <class _A1> |
1391 | inline _LIBCPP_INLINE_VISIBILITY |
1392 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1393 | logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);} |
1394 | |
1395 | // lrint |
1396 | |
1397 | inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);} |
1398 | inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);} |
1399 | |
1400 | template <class _A1> |
1401 | inline _LIBCPP_INLINE_VISIBILITY |
1402 | typename std::enable_if<std::is_integral<_A1>::value, long>::type |
1403 | lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);} |
1404 | |
1405 | // lround |
1406 | |
1407 | inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);} |
1408 | inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);} |
1409 | |
1410 | template <class _A1> |
1411 | inline _LIBCPP_INLINE_VISIBILITY |
1412 | typename std::enable_if<std::is_integral<_A1>::value, long>::type |
1413 | lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);} |
1414 | |
1415 | // nan |
1416 | |
1417 | // nearbyint |
1418 | |
1419 | inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);} |
1420 | inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);} |
1421 | |
1422 | template <class _A1> |
1423 | inline _LIBCPP_INLINE_VISIBILITY |
1424 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1425 | nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);} |
1426 | |
1427 | // nextafter |
1428 | |
1429 | inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);} |
1430 | inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);} |
1431 | |
1432 | template <class _A1, class _A2> |
1433 | inline _LIBCPP_INLINE_VISIBILITY |
1434 | typename std::_EnableIf |
1435 | < |
1436 | std::is_arithmetic<_A1>::value && |
1437 | std::is_arithmetic<_A2>::value, |
1438 | std::__promote<_A1, _A2> |
1439 | >::type |
1440 | nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1441 | { |
1442 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1443 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1444 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1445 | return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1446 | } |
1447 | |
1448 | // nexttoward |
1449 | |
1450 | inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);} |
1451 | inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);} |
1452 | |
1453 | template <class _A1> |
1454 | inline _LIBCPP_INLINE_VISIBILITY |
1455 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1456 | nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);} |
1457 | |
1458 | // remainder |
1459 | |
1460 | inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);} |
1461 | inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);} |
1462 | |
1463 | template <class _A1, class _A2> |
1464 | inline _LIBCPP_INLINE_VISIBILITY |
1465 | typename std::_EnableIf |
1466 | < |
1467 | std::is_arithmetic<_A1>::value && |
1468 | std::is_arithmetic<_A2>::value, |
1469 | std::__promote<_A1, _A2> |
1470 | >::type |
1471 | remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT |
1472 | { |
1473 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1474 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1475 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1476 | return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); |
1477 | } |
1478 | |
1479 | // remquo |
1480 | |
1481 | inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);} |
1482 | 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);} |
1483 | |
1484 | template <class _A1, class _A2> |
1485 | inline _LIBCPP_INLINE_VISIBILITY |
1486 | typename std::_EnableIf |
1487 | < |
1488 | std::is_arithmetic<_A1>::value && |
1489 | std::is_arithmetic<_A2>::value, |
1490 | std::__promote<_A1, _A2> |
1491 | >::type |
1492 | remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT |
1493 | { |
1494 | typedef typename std::__promote<_A1, _A2>::type __result_type; |
1495 | static_assert((!(std::_IsSame<_A1, __result_type>::value && |
1496 | std::_IsSame<_A2, __result_type>::value)), "" ); |
1497 | return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); |
1498 | } |
1499 | |
1500 | // rint |
1501 | |
1502 | inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);} |
1503 | inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);} |
1504 | |
1505 | template <class _A1> |
1506 | inline _LIBCPP_INLINE_VISIBILITY |
1507 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1508 | rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);} |
1509 | |
1510 | // round |
1511 | |
1512 | inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);} |
1513 | inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);} |
1514 | |
1515 | template <class _A1> |
1516 | inline _LIBCPP_INLINE_VISIBILITY |
1517 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1518 | round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);} |
1519 | |
1520 | // scalbln |
1521 | |
1522 | inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);} |
1523 | inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);} |
1524 | |
1525 | template <class _A1> |
1526 | inline _LIBCPP_INLINE_VISIBILITY |
1527 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1528 | scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);} |
1529 | |
1530 | // scalbn |
1531 | |
1532 | inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);} |
1533 | inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);} |
1534 | |
1535 | template <class _A1> |
1536 | inline _LIBCPP_INLINE_VISIBILITY |
1537 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1538 | scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);} |
1539 | |
1540 | // tgamma |
1541 | |
1542 | inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);} |
1543 | inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);} |
1544 | |
1545 | template <class _A1> |
1546 | inline _LIBCPP_INLINE_VISIBILITY |
1547 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1548 | tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);} |
1549 | |
1550 | // trunc |
1551 | |
1552 | inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);} |
1553 | inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);} |
1554 | |
1555 | template <class _A1> |
1556 | inline _LIBCPP_INLINE_VISIBILITY |
1557 | typename std::enable_if<std::is_integral<_A1>::value, double>::type |
1558 | trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);} |
1559 | |
1560 | } // extern "C++" |
1561 | |
1562 | #endif // __cplusplus |
1563 | |
1564 | #else // _LIBCPP_MATH_H |
1565 | |
1566 | // This include lives outside the header guard in order to support an MSVC |
1567 | // extension which allows users to do: |
1568 | // |
1569 | // #define _USE_MATH_DEFINES |
1570 | // #include <math.h> |
1571 | // |
1572 | // and receive the definitions of mathematical constants, even if <math.h> |
1573 | // has previously been included. |
1574 | #if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES) |
1575 | #include_next <math.h> |
1576 | #endif |
1577 | |
1578 | #endif // _LIBCPP_MATH_H |
1579 | |