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