cmath revision 246468
1227825Stheraven// -*- C++ -*-
2227825Stheraven//===---------------------------- cmath -----------------------------------===//
3227825Stheraven//
4227825Stheraven//                     The LLVM Compiler Infrastructure
5227825Stheraven//
6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open
7227825Stheraven// Source Licenses. See LICENSE.TXT for details.
8227825Stheraven//
9227825Stheraven//===----------------------------------------------------------------------===//
10227825Stheraven
11227825Stheraven#ifndef _LIBCPP_CMATH
12227825Stheraven#define _LIBCPP_CMATH
13227825Stheraven
14227825Stheraven/*
15227825Stheraven    cmath synopsis
16227825Stheraven
17227825StheravenMacros:
18227825Stheraven
19227825Stheraven    HUGE_VAL
20227825Stheraven    HUGE_VALF               // C99
21227825Stheraven    HUGE_VALL               // C99
22227825Stheraven    INFINITY                // C99
23227825Stheraven    NAN                     // C99
24227825Stheraven    FP_INFINITE             // C99
25227825Stheraven    FP_NAN                  // C99
26227825Stheraven    FP_NORMAL               // C99
27227825Stheraven    FP_SUBNORMAL            // C99
28227825Stheraven    FP_ZERO                 // C99
29227825Stheraven    FP_FAST_FMA             // C99
30227825Stheraven    FP_FAST_FMAF            // C99
31227825Stheraven    FP_FAST_FMAL            // C99
32227825Stheraven    FP_ILOGB0               // C99
33227825Stheraven    FP_ILOGBNAN             // C99
34227825Stheraven    MATH_ERRNO              // C99
35227825Stheraven    MATH_ERREXCEPT          // C99
36227825Stheraven    math_errhandling        // C99
37227825Stheraven
38227825Stheravennamespace std
39227825Stheraven{
40227825Stheraven
41227825StheravenTypes:
42227825Stheraven
43227825Stheraven    float_t                 // C99
44227825Stheraven    double_t                // C99
45227825Stheraven
46227825Stheraven// C90
47227825Stheraven
48227825Stheravenfloating_point abs(floating_point x);
49227825Stheraven
50227825Stheravenfloating_point acos (arithmetic x);
51227825Stheravenfloat          acosf(float x);
52227825Stheravenlong double    acosl(long double x);
53227825Stheraven
54227825Stheravenfloating_point asin (arithmetic x);
55227825Stheravenfloat          asinf(float x);
56227825Stheravenlong double    asinl(long double x);
57227825Stheraven
58227825Stheravenfloating_point atan (arithmetic x);
59227825Stheravenfloat          atanf(float x);
60227825Stheravenlong double    atanl(long double x);
61227825Stheraven
62227825Stheravenfloating_point atan2 (arithmetic y, arithmetic x);
63227825Stheravenfloat          atan2f(float y, float x);
64227825Stheravenlong double    atan2l(long double y, long double x);
65227825Stheraven
66227825Stheravenfloating_point ceil (arithmetic x);
67227825Stheravenfloat          ceilf(float x);
68227825Stheravenlong double    ceill(long double x);
69227825Stheraven
70227825Stheravenfloating_point cos (arithmetic x);
71227825Stheravenfloat          cosf(float x);
72227825Stheravenlong double    cosl(long double x);
73227825Stheraven
74227825Stheravenfloating_point cosh (arithmetic x);
75227825Stheravenfloat          coshf(float x);
76227825Stheravenlong double    coshl(long double x);
77227825Stheraven
78227825Stheravenfloating_point exp (arithmetic x);
79227825Stheravenfloat          expf(float x);
80227825Stheravenlong double    expl(long double x);
81227825Stheraven
82227825Stheravenfloating_point fabs (arithmetic x);
83227825Stheravenfloat          fabsf(float x);
84227825Stheravenlong double    fabsl(long double x);
85227825Stheraven
86227825Stheravenfloating_point floor (arithmetic x);
87227825Stheravenfloat          floorf(float x);
88227825Stheravenlong double    floorl(long double x);
89227825Stheraven
90227825Stheravenfloating_point fmod (arithmetic x, arithmetic y);
91227825Stheravenfloat          fmodf(float x, float y);
92227825Stheravenlong double    fmodl(long double x, long double y);
93227825Stheraven
94227825Stheravenfloating_point frexp (arithmetic value, int* exp);
95227825Stheravenfloat          frexpf(float value, int* exp);
96227825Stheravenlong double    frexpl(long double value, int* exp);
97227825Stheraven
98227825Stheravenfloating_point ldexp (arithmetic value, int exp);
99227825Stheravenfloat          ldexpf(float value, int exp);
100227825Stheravenlong double    ldexpl(long double value, int exp);
101227825Stheraven
102227825Stheravenfloating_point log (arithmetic x);
103227825Stheravenfloat          logf(float x);
104227825Stheravenlong double    logl(long double x);
105227825Stheraven
106227825Stheravenfloating_point log10 (arithmetic x);
107227825Stheravenfloat          log10f(float x);
108227825Stheravenlong double    log10l(long double x);
109227825Stheraven
110227825Stheravenfloating_point modf (floating_point value, floating_point* iptr);
111227825Stheravenfloat          modff(float value, float* iptr);
112227825Stheravenlong double    modfl(long double value, long double* iptr);
113227825Stheraven
114227825Stheravenfloating_point pow (arithmetic x, arithmetic y);
115227825Stheravenfloat          powf(float x, float y);
116227825Stheravenlong double    powl(long double x, long double y);
117227825Stheraven
118227825Stheravenfloating_point sin (arithmetic x);
119227825Stheravenfloat          sinf(float x);
120227825Stheravenlong double    sinl(long double x);
121227825Stheraven
122227825Stheravenfloating_point sinh (arithmetic x);
123227825Stheravenfloat          sinhf(float x);
124227825Stheravenlong double    sinhl(long double x);
125227825Stheraven
126227825Stheravenfloating_point sqrt (arithmetic x);
127227825Stheravenfloat          sqrtf(float x);
128227825Stheravenlong double    sqrtl(long double x);
129227825Stheraven
130227825Stheravenfloating_point tan (arithmetic x);
131227825Stheravenfloat          tanf(float x);
132227825Stheravenlong double    tanl(long double x);
133227825Stheraven
134227825Stheravenfloating_point tanh (arithmetic x);
135227825Stheravenfloat          tanhf(float x);
136227825Stheravenlong double    tanhl(long double x);
137227825Stheraven
138227825Stheraven//  C99
139227825Stheraven
140246468Stheravenbool signbit(arithmetic x);
141227825Stheraven
142246468Stheravenint fpclassify(arithmetic x);
143227825Stheraven
144246468Stheravenbool isfinite(arithmetic x);
145246468Stheravenbool isinf(arithmetic x);
146246468Stheravenbool isnan(arithmetic x);
147246468Stheravenbool isnormal(arithmetic x);
148227825Stheraven
149246468Stheravenbool isgreater(arithmetic x, arithmetic y);
150246468Stheravenbool isgreaterequal(arithmetic x, arithmetic y);
151246468Stheravenbool isless(arithmetic x, arithmetic y);
152246468Stheravenbool islessequal(arithmetic x, arithmetic y);
153246468Stheravenbool islessgreater(arithmetic x, arithmetic y);
154246468Stheravenbool isunordered(arithmetic x, arithmetic y);
155227825Stheraven
156227825Stheravenfloating_point acosh (arithmetic x);
157227825Stheravenfloat          acoshf(float x);
158227825Stheravenlong double    acoshl(long double x);
159227825Stheraven
160227825Stheravenfloating_point asinh (arithmetic x);
161227825Stheravenfloat          asinhf(float x);
162227825Stheravenlong double    asinhl(long double x);
163227825Stheraven
164227825Stheravenfloating_point atanh (arithmetic x);
165227825Stheravenfloat          atanhf(float x);
166227825Stheravenlong double    atanhl(long double x);
167227825Stheraven
168227825Stheravenfloating_point cbrt (arithmetic x);
169227825Stheravenfloat          cbrtf(float x);
170227825Stheravenlong double    cbrtl(long double x);
171227825Stheraven
172227825Stheravenfloating_point copysign (arithmetic x, arithmetic y);
173227825Stheravenfloat          copysignf(float x, float y);
174227825Stheravenlong double    copysignl(long double x, long double y);
175227825Stheraven
176227825Stheravenfloating_point erf (arithmetic x);
177227825Stheravenfloat          erff(float x);
178227825Stheravenlong double    erfl(long double x);
179227825Stheraven
180227825Stheravenfloating_point erfc (arithmetic x);
181227825Stheravenfloat          erfcf(float x);
182227825Stheravenlong double    erfcl(long double x);
183227825Stheraven
184227825Stheravenfloating_point exp2 (arithmetic x);
185227825Stheravenfloat          exp2f(float x);
186227825Stheravenlong double    exp2l(long double x);
187227825Stheraven
188227825Stheravenfloating_point expm1 (arithmetic x);
189227825Stheravenfloat          expm1f(float x);
190227825Stheravenlong double    expm1l(long double x);
191227825Stheraven
192227825Stheravenfloating_point fdim (arithmetic x, arithmetic y);
193227825Stheravenfloat          fdimf(float x, float y);
194227825Stheravenlong double    fdiml(long double x, long double y);
195227825Stheraven
196227825Stheravenfloating_point fma (arithmetic x, arithmetic y, arithmetic z);
197227825Stheravenfloat          fmaf(float x, float y, float z);
198227825Stheravenlong double    fmal(long double x, long double y, long double z);
199227825Stheraven
200227825Stheravenfloating_point fmax (arithmetic x, arithmetic y);
201227825Stheravenfloat          fmaxf(float x, float y);
202227825Stheravenlong double    fmaxl(long double x, long double y);
203227825Stheraven
204227825Stheravenfloating_point fmin (arithmetic x, arithmetic y);
205227825Stheravenfloat          fminf(float x, float y);
206227825Stheravenlong double    fminl(long double x, long double y);
207227825Stheraven
208227825Stheravenfloating_point hypot (arithmetic x, arithmetic y);
209227825Stheravenfloat          hypotf(float x, float y);
210227825Stheravenlong double    hypotl(long double x, long double y);
211227825Stheraven
212227825Stheravenint ilogb (arithmetic x);
213227825Stheravenint ilogbf(float x);
214227825Stheravenint ilogbl(long double x);
215227825Stheraven
216227825Stheravenfloating_point lgamma (arithmetic x);
217227825Stheravenfloat          lgammaf(float x);
218227825Stheravenlong double    lgammal(long double x);
219227825Stheraven
220227825Stheravenlong long llrint (arithmetic x);
221227825Stheravenlong long llrintf(float x);
222227825Stheravenlong long llrintl(long double x);
223227825Stheraven
224227825Stheravenlong long llround (arithmetic x);
225227825Stheravenlong long llroundf(float x);
226227825Stheravenlong long llroundl(long double x);
227227825Stheraven
228227825Stheravenfloating_point log1p (arithmetic x);
229227825Stheravenfloat          log1pf(float x);
230227825Stheravenlong double    log1pl(long double x);
231227825Stheraven
232227825Stheravenfloating_point log2 (arithmetic x);
233227825Stheravenfloat          log2f(float x);
234227825Stheravenlong double    log2l(long double x);
235227825Stheraven
236227825Stheravenfloating_point logb (arithmetic x);
237227825Stheravenfloat          logbf(float x);
238227825Stheravenlong double    logbl(long double x);
239227825Stheraven
240227825Stheravenlong lrint (arithmetic x);
241227825Stheravenlong lrintf(float x);
242227825Stheravenlong lrintl(long double x);
243227825Stheraven
244227825Stheravenlong lround (arithmetic x);
245227825Stheravenlong lroundf(float x);
246227825Stheravenlong lroundl(long double x);
247227825Stheraven
248227825Stheravendouble      nan (const char* str);
249227825Stheravenfloat       nanf(const char* str);
250227825Stheravenlong double nanl(const char* str);
251227825Stheraven
252227825Stheravenfloating_point nearbyint (arithmetic x);
253227825Stheravenfloat          nearbyintf(float x);
254227825Stheravenlong double    nearbyintl(long double x);
255227825Stheraven
256227825Stheravenfloating_point nextafter (arithmetic x, arithmetic y);
257227825Stheravenfloat          nextafterf(float x, float y);
258227825Stheravenlong double    nextafterl(long double x, long double y);
259227825Stheraven
260227825Stheravenfloating_point nexttoward (arithmetic x, long double y);
261227825Stheravenfloat          nexttowardf(float x, long double y);
262227825Stheravenlong double    nexttowardl(long double x, long double y);
263227825Stheraven
264227825Stheravenfloating_point remainder (arithmetic x, arithmetic y);
265227825Stheravenfloat          remainderf(float x, float y);
266227825Stheravenlong double    remainderl(long double x, long double y);
267227825Stheraven
268227825Stheravenfloating_point remquo (arithmetic x, arithmetic y, int* pquo);
269227825Stheravenfloat          remquof(float x, float y, int* pquo);
270227825Stheravenlong double    remquol(long double x, long double y, int* pquo);
271227825Stheraven
272227825Stheravenfloating_point rint (arithmetic x);
273227825Stheravenfloat          rintf(float x);
274227825Stheravenlong double    rintl(long double x);
275227825Stheraven
276227825Stheravenfloating_point round (arithmetic x);
277227825Stheravenfloat          roundf(float x);
278227825Stheravenlong double    roundl(long double x);
279227825Stheraven
280227825Stheravenfloating_point scalbln (arithmetic x, long ex);
281227825Stheravenfloat          scalblnf(float x, long ex);
282227825Stheravenlong double    scalblnl(long double x, long ex);
283227825Stheraven
284227825Stheravenfloating_point scalbn (arithmetic x, int ex);
285227825Stheravenfloat          scalbnf(float x, int ex);
286227825Stheravenlong double    scalbnl(long double x, int ex);
287227825Stheraven
288227825Stheravenfloating_point tgamma (arithmetic x);
289227825Stheravenfloat          tgammaf(float x);
290227825Stheravenlong double    tgammal(long double x);
291227825Stheraven
292227825Stheravenfloating_point trunc (arithmetic x);
293227825Stheravenfloat          truncf(float x);
294227825Stheravenlong double    truncl(long double x);
295227825Stheraven
296227825Stheraven}  // std
297227825Stheraven
298227825Stheraven*/
299227825Stheraven
300227825Stheraven#include <__config>
301227825Stheraven#include <math.h>
302227825Stheraven#include <type_traits>
303227825Stheraven
304227825Stheraven#ifdef _MSC_VER
305227825Stheraven#include "support/win32/math_win32.h"
306227825Stheraven#endif
307227825Stheraven
308227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
309227825Stheraven#pragma GCC system_header
310227825Stheraven#endif
311227825Stheraven
312227825Stheraven// signbit
313227825Stheraven
314227825Stheraven#ifdef signbit
315227825Stheraven
316227825Stheraventemplate <class _A1>
317227825Stheraven_LIBCPP_ALWAYS_INLINE
318227825Stheravenbool
319241900Sdim__libcpp_signbit(_A1 __x) _NOEXCEPT
320227825Stheraven{
321227825Stheraven    return signbit(__x);
322227825Stheraven}
323227825Stheraven
324227825Stheraven#undef signbit
325227825Stheraven
326227825Stheraventemplate <class _A1>
327227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
328246468Stheraventypename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
329241900Sdimsignbit(_A1 __x) _NOEXCEPT
330227825Stheraven{
331246468Stheraven    return __libcpp_signbit((typename std::__promote<_A1>::type)__x);
332227825Stheraven}
333227825Stheraven
334227825Stheraven#endif  // signbit
335227825Stheraven
336227825Stheraven// fpclassify
337227825Stheraven
338227825Stheraven#ifdef fpclassify
339227825Stheraven
340227825Stheraventemplate <class _A1>
341227825Stheraven_LIBCPP_ALWAYS_INLINE
342227825Stheravenint
343241900Sdim__libcpp_fpclassify(_A1 __x) _NOEXCEPT
344227825Stheraven{
345227825Stheraven    return fpclassify(__x);
346227825Stheraven}
347227825Stheraven
348227825Stheraven#undef fpclassify
349227825Stheraven
350227825Stheraventemplate <class _A1>
351227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
352246468Stheraventypename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
353241900Sdimfpclassify(_A1 __x) _NOEXCEPT
354227825Stheraven{
355246468Stheraven    return __libcpp_fpclassify((typename std::__promote<_A1>::type)__x);
356227825Stheraven}
357227825Stheraven
358227825Stheraven#endif  // fpclassify
359227825Stheraven
360227825Stheraven// isfinite
361227825Stheraven
362227825Stheraven#ifdef isfinite
363227825Stheraven
364227825Stheraventemplate <class _A1>
365227825Stheraven_LIBCPP_ALWAYS_INLINE
366227825Stheravenbool
367241900Sdim__libcpp_isfinite(_A1 __x) _NOEXCEPT
368227825Stheraven{
369227825Stheraven    return isfinite(__x);
370227825Stheraven}
371227825Stheraven
372227825Stheraven#undef isfinite
373227825Stheraven
374227825Stheraventemplate <class _A1>
375227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
376246468Stheraventypename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
377241900Sdimisfinite(_A1 __x) _NOEXCEPT
378227825Stheraven{
379246468Stheraven    return __libcpp_isfinite((typename std::__promote<_A1>::type)__x);
380227825Stheraven}
381227825Stheraven
382227825Stheraven#endif  // isfinite
383227825Stheraven
384227825Stheraven// isinf
385227825Stheraven
386227825Stheraven#ifdef isinf
387227825Stheraven
388227825Stheraventemplate <class _A1>
389227825Stheraven_LIBCPP_ALWAYS_INLINE
390227825Stheravenbool
391241900Sdim__libcpp_isinf(_A1 __x) _NOEXCEPT
392227825Stheraven{
393227825Stheraven    return isinf(__x);
394227825Stheraven}
395227825Stheraven
396227825Stheraven#undef isinf
397227825Stheraven
398227825Stheraventemplate <class _A1>
399227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
400246468Stheraventypename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
401241900Sdimisinf(_A1 __x) _NOEXCEPT
402227825Stheraven{
403246468Stheraven    return __libcpp_isinf((typename std::__promote<_A1>::type)__x);
404227825Stheraven}
405227825Stheraven
406227825Stheraven#endif  // isinf
407227825Stheraven
408227825Stheraven// isnan
409227825Stheraven
410227825Stheraven#ifdef isnan
411227825Stheraven
412227825Stheraventemplate <class _A1>
413227825Stheraven_LIBCPP_ALWAYS_INLINE
414227825Stheravenbool
415241900Sdim__libcpp_isnan(_A1 __x) _NOEXCEPT
416227825Stheraven{
417227825Stheraven    return isnan(__x);
418227825Stheraven}
419227825Stheraven
420227825Stheraven#undef isnan
421227825Stheraven
422227825Stheraventemplate <class _A1>
423227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
424246468Stheraventypename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
425241900Sdimisnan(_A1 __x) _NOEXCEPT
426227825Stheraven{
427246468Stheraven    return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
428227825Stheraven}
429227825Stheraven
430227825Stheraven#endif  // isnan
431227825Stheraven
432227825Stheraven// isnormal
433227825Stheraven
434227825Stheraven#ifdef isnormal
435227825Stheraven
436227825Stheraventemplate <class _A1>
437227825Stheraven_LIBCPP_ALWAYS_INLINE
438227825Stheravenbool
439241900Sdim__libcpp_isnormal(_A1 __x) _NOEXCEPT
440227825Stheraven{
441227825Stheraven    return isnormal(__x);
442227825Stheraven}
443227825Stheraven
444227825Stheraven#undef isnormal
445227825Stheraven
446227825Stheraventemplate <class _A1>
447227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
448246468Stheraventypename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
449241900Sdimisnormal(_A1 __x) _NOEXCEPT
450227825Stheraven{
451246468Stheraven    return __libcpp_isnormal((typename std::__promote<_A1>::type)__x);
452227825Stheraven}
453227825Stheraven
454227825Stheraven#endif  // isnormal
455227825Stheraven
456227825Stheraven// isgreater
457227825Stheraven
458227825Stheraven#ifdef isgreater
459227825Stheraven
460227825Stheraventemplate <class _A1, class _A2>
461227825Stheraven_LIBCPP_ALWAYS_INLINE
462227825Stheravenbool
463241900Sdim__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
464227825Stheraven{
465227825Stheraven    return isgreater(__x, __y);
466227825Stheraven}
467227825Stheraven
468227825Stheraven#undef isgreater
469227825Stheraven
470227825Stheraventemplate <class _A1, class _A2>
471227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
472227825Stheraventypename std::enable_if
473227825Stheraven<
474246468Stheraven    std::is_arithmetic<_A1>::value &&
475246468Stheraven    std::is_arithmetic<_A2>::value,
476227825Stheraven    bool
477227825Stheraven>::type
478241900Sdimisgreater(_A1 __x, _A2 __y) _NOEXCEPT
479227825Stheraven{
480246468Stheraven    typedef typename std::__promote<_A1, _A2>::type type;
481246468Stheraven    return __libcpp_isgreater((type)__x, (type)__y);
482227825Stheraven}
483227825Stheraven
484227825Stheraven#endif  // isgreater
485227825Stheraven
486227825Stheraven// isgreaterequal
487227825Stheraven
488227825Stheraven#ifdef isgreaterequal
489227825Stheraven
490227825Stheraventemplate <class _A1, class _A2>
491227825Stheraven_LIBCPP_ALWAYS_INLINE
492227825Stheravenbool
493241900Sdim__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
494227825Stheraven{
495227825Stheraven    return isgreaterequal(__x, __y);
496227825Stheraven}
497227825Stheraven
498227825Stheraven#undef isgreaterequal
499227825Stheraven
500227825Stheraventemplate <class _A1, class _A2>
501227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
502227825Stheraventypename std::enable_if
503227825Stheraven<
504246468Stheraven    std::is_arithmetic<_A1>::value &&
505246468Stheraven    std::is_arithmetic<_A2>::value,
506227825Stheraven    bool
507227825Stheraven>::type
508241900Sdimisgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
509227825Stheraven{
510246468Stheraven    typedef typename std::__promote<_A1, _A2>::type type;
511246468Stheraven    return __libcpp_isgreaterequal((type)__x, (type)__y);
512227825Stheraven}
513227825Stheraven
514227825Stheraven#endif  // isgreaterequal
515227825Stheraven
516227825Stheraven// isless
517227825Stheraven
518227825Stheraven#ifdef isless
519227825Stheraven
520227825Stheraventemplate <class _A1, class _A2>
521227825Stheraven_LIBCPP_ALWAYS_INLINE
522227825Stheravenbool
523241900Sdim__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
524227825Stheraven{
525227825Stheraven    return isless(__x, __y);
526227825Stheraven}
527227825Stheraven
528227825Stheraven#undef isless
529227825Stheraven
530227825Stheraventemplate <class _A1, class _A2>
531227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
532227825Stheraventypename std::enable_if
533227825Stheraven<
534246468Stheraven    std::is_arithmetic<_A1>::value &&
535246468Stheraven    std::is_arithmetic<_A2>::value,
536227825Stheraven    bool
537227825Stheraven>::type
538241900Sdimisless(_A1 __x, _A2 __y) _NOEXCEPT
539227825Stheraven{
540246468Stheraven    typedef typename std::__promote<_A1, _A2>::type type;
541246468Stheraven    return __libcpp_isless((type)__x, (type)__y);
542227825Stheraven}
543227825Stheraven
544227825Stheraven#endif  // isless
545227825Stheraven
546227825Stheraven// islessequal
547227825Stheraven
548227825Stheraven#ifdef islessequal
549227825Stheraven
550227825Stheraventemplate <class _A1, class _A2>
551227825Stheraven_LIBCPP_ALWAYS_INLINE
552227825Stheravenbool
553241900Sdim__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
554227825Stheraven{
555227825Stheraven    return islessequal(__x, __y);
556227825Stheraven}
557227825Stheraven
558227825Stheraven#undef islessequal
559227825Stheraven
560227825Stheraventemplate <class _A1, class _A2>
561227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
562227825Stheraventypename std::enable_if
563227825Stheraven<
564246468Stheraven    std::is_arithmetic<_A1>::value &&
565246468Stheraven    std::is_arithmetic<_A2>::value,
566227825Stheraven    bool
567227825Stheraven>::type
568241900Sdimislessequal(_A1 __x, _A2 __y) _NOEXCEPT
569227825Stheraven{
570246468Stheraven    typedef typename std::__promote<_A1, _A2>::type type;
571246468Stheraven    return __libcpp_islessequal((type)__x, (type)__y);
572227825Stheraven}
573227825Stheraven
574227825Stheraven#endif  // islessequal
575227825Stheraven
576227825Stheraven// islessgreater
577227825Stheraven
578227825Stheraven#ifdef islessgreater
579227825Stheraven
580227825Stheraventemplate <class _A1, class _A2>
581227825Stheraven_LIBCPP_ALWAYS_INLINE
582227825Stheravenbool
583241900Sdim__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
584227825Stheraven{
585227825Stheraven    return islessgreater(__x, __y);
586227825Stheraven}
587227825Stheraven
588227825Stheraven#undef islessgreater
589227825Stheraven
590227825Stheraventemplate <class _A1, class _A2>
591227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
592227825Stheraventypename std::enable_if
593227825Stheraven<
594246468Stheraven    std::is_arithmetic<_A1>::value &&
595246468Stheraven    std::is_arithmetic<_A2>::value,
596227825Stheraven    bool
597227825Stheraven>::type
598241900Sdimislessgreater(_A1 __x, _A2 __y) _NOEXCEPT
599227825Stheraven{
600246468Stheraven    typedef typename std::__promote<_A1, _A2>::type type;
601246468Stheraven    return __libcpp_islessgreater((type)__x, (type)__y);
602227825Stheraven}
603227825Stheraven
604227825Stheraven#endif  // islessgreater
605227825Stheraven
606227825Stheraven// isunordered
607227825Stheraven
608227825Stheraven#ifdef isunordered
609227825Stheraven
610227825Stheraventemplate <class _A1, class _A2>
611227825Stheraven_LIBCPP_ALWAYS_INLINE
612227825Stheravenbool
613241900Sdim__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
614227825Stheraven{
615227825Stheraven    return isunordered(__x, __y);
616227825Stheraven}
617227825Stheraven
618227825Stheraven#undef isunordered
619227825Stheraven
620227825Stheraventemplate <class _A1, class _A2>
621227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
622227825Stheraventypename std::enable_if
623227825Stheraven<
624246468Stheraven    std::is_arithmetic<_A1>::value &&
625246468Stheraven    std::is_arithmetic<_A2>::value,
626227825Stheraven    bool
627227825Stheraven>::type
628241900Sdimisunordered(_A1 __x, _A2 __y) _NOEXCEPT
629227825Stheraven{
630246468Stheraven    typedef typename std::__promote<_A1, _A2>::type type;
631246468Stheraven    return __libcpp_isunordered((type)__x, (type)__y);
632227825Stheraven}
633227825Stheraven
634227825Stheraven#endif  // isunordered
635227825Stheraven
636227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD
637227825Stheraven
638227825Stheravenusing ::signbit;
639227825Stheravenusing ::fpclassify;
640227825Stheravenusing ::isfinite;
641227825Stheravenusing ::isinf;
642227825Stheravenusing ::isnan;
643227825Stheravenusing ::isnormal;
644227825Stheravenusing ::isgreater;
645227825Stheravenusing ::isgreaterequal;
646227825Stheravenusing ::isless;
647227825Stheravenusing ::islessequal;
648227825Stheravenusing ::islessgreater;
649227825Stheravenusing ::isunordered;
650227825Stheravenusing ::isunordered;
651227825Stheraven
652227825Stheravenusing ::float_t;
653227825Stheravenusing ::double_t;
654227825Stheraven
655227825Stheraven// abs
656227825Stheraven
657227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
658234959Stheravenfloat
659241900Sdimabs(float __x) _NOEXCEPT {return fabsf(__x);}
660227825Stheraven
661234959Stheraveninline _LIBCPP_INLINE_VISIBILITY
662234959Stheravendouble
663241900Sdimabs(double __x) _NOEXCEPT {return fabs(__x);}
664234959Stheraven
665234959Stheraveninline _LIBCPP_INLINE_VISIBILITY
666234959Stheravenlong double
667241900Sdimabs(long double __x) _NOEXCEPT {return fabsl(__x);}
668234959Stheraven
669232924Stheraven#ifndef __sun__
670232924Stheraven
671227825Stheraven// acos
672227825Stheraven
673227825Stheravenusing ::acos;
674227825Stheravenusing ::acosf;
675227825Stheraven
676227825Stheraven#ifndef _MSC_VER
677241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       acos(float __x) _NOEXCEPT       {return acosf(__x);}
678241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
679227825Stheraven#endif
680227825Stheraven
681227825Stheraventemplate <class _A1>
682227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
683227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
684241900Sdimacos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
685227825Stheraven
686227825Stheraven// asin
687227825Stheraven
688227825Stheravenusing ::asin;
689227825Stheravenusing ::asinf;
690227825Stheraven
691227825Stheraven#ifndef _MSC_VER
692241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       asin(float __x) _NOEXCEPT       {return asinf(__x);}
693241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
694227825Stheraven#endif
695227825Stheraven
696227825Stheraventemplate <class _A1>
697227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
698227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
699241900Sdimasin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
700227825Stheraven
701227825Stheraven// atan
702227825Stheraven
703227825Stheravenusing ::atan;
704227825Stheravenusing ::atanf;
705227825Stheraven
706227825Stheraven#ifndef _MSC_VER
707241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       atan(float __x) _NOEXCEPT       {return atanf(__x);}
708241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
709227825Stheraven#endif
710227825Stheraven
711227825Stheraventemplate <class _A1>
712227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
713227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
714241900Sdimatan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
715227825Stheraven
716227825Stheraven// atan2
717227825Stheraven
718227825Stheravenusing ::atan2;
719227825Stheravenusing ::atan2f;
720227825Stheraven
721227825Stheraven#ifndef _MSC_VER
722241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       atan2(float __y, float __x) _NOEXCEPT             {return atan2f(__y, __x);}
723241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
724227825Stheraven#endif
725227825Stheraven
726227825Stheraventemplate <class _A1, class _A2>
727227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
728227825Stheraventypename enable_if
729227825Stheraven<
730227825Stheraven    is_arithmetic<_A1>::value &&
731227825Stheraven    is_arithmetic<_A2>::value,
732227825Stheraven    typename __promote<_A1, _A2>::type
733227825Stheraven>::type
734241900Sdimatan2(_A1 __y, _A2 __x) _NOEXCEPT
735227825Stheraven{
736227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
737227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
738227825Stheraven                      is_same<_A2, __result_type>::value)), "");
739227825Stheraven    return atan2((__result_type)__y, (__result_type)__x);
740227825Stheraven}
741227825Stheraven
742227825Stheraven// ceil
743227825Stheraven
744227825Stheravenusing ::ceil;
745227825Stheravenusing ::ceilf;
746227825Stheraven
747227825Stheraven#ifndef _MSC_VER
748241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       ceil(float __x) _NOEXCEPT       {return ceilf(__x);}
749241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
750227825Stheraven#endif
751227825Stheraven
752227825Stheraventemplate <class _A1>
753227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
754227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
755241900Sdimceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
756227825Stheraven
757227825Stheraven// cos
758227825Stheraven
759227825Stheravenusing ::cos;
760227825Stheravenusing ::cosf;
761227825Stheraven
762227825Stheraven#ifndef _MSC_VER
763241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       cos(float __x) _NOEXCEPT       {return cosf(__x);}
764241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
765227825Stheraven#endif
766227825Stheraven
767227825Stheraventemplate <class _A1>
768227825Stheraveninline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
769227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
770241900Sdimcos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
771227825Stheraven
772227825Stheraven// cosh
773227825Stheraven
774227825Stheravenusing ::cosh;
775227825Stheravenusing ::coshf;
776227825Stheraven
777227825Stheraven#ifndef _MSC_VER
778241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       cosh(float __x) _NOEXCEPT       {return coshf(__x);}
779241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
780227825Stheraven#endif
781227825Stheraven
782227825Stheraventemplate <class _A1>
783227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
784227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
785241900Sdimcosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);}
786227825Stheraven
787232924Stheraven#endif // __sun__
788227825Stheraven// exp
789227825Stheraven
790227825Stheravenusing ::exp;
791227825Stheravenusing ::expf;
792227825Stheraven
793232924Stheraven#ifndef __sun__
794232924Stheraven
795227825Stheraven#ifndef _MSC_VER
796241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       exp(float __x) _NOEXCEPT       {return expf(__x);}
797241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
798227825Stheraven#endif
799227825Stheraven
800232924Stheraven
801227825Stheraventemplate <class _A1>
802227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
803227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
804241900Sdimexp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
805227825Stheraven
806227825Stheraven// fabs
807227825Stheraven
808227825Stheravenusing ::fabs;
809227825Stheravenusing ::fabsf;
810227825Stheraven
811227825Stheraven#ifndef _MSC_VER
812241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       fabs(float __x) _NOEXCEPT       {return fabsf(__x);}
813241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
814227825Stheraven#endif
815227825Stheraven
816227825Stheraventemplate <class _A1>
817227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
818227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
819241900Sdimfabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
820227825Stheraven
821227825Stheraven// floor
822227825Stheraven
823227825Stheravenusing ::floor;
824227825Stheravenusing ::floorf;
825227825Stheraven
826227825Stheraven#ifndef _MSC_VER
827241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       floor(float __x) _NOEXCEPT       {return floorf(__x);}
828241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
829227825Stheraven#endif
830227825Stheraven
831227825Stheraventemplate <class _A1>
832227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
833227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
834241900Sdimfloor(_A1 __x) _NOEXCEPT {return floor((double)__x);}
835227825Stheraven
836227825Stheraven// fmod
837227825Stheraven
838232924Stheraven#endif //__sun__
839227825Stheravenusing ::fmod;
840227825Stheravenusing ::fmodf;
841232924Stheraven#ifndef __sun__
842227825Stheraven
843227825Stheraven#ifndef _MSC_VER
844241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       fmod(float __x, float __y) _NOEXCEPT             {return fmodf(__x, __y);}
845241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
846227825Stheraven#endif
847227825Stheraven
848227825Stheraventemplate <class _A1, class _A2>
849227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
850227825Stheraventypename enable_if
851227825Stheraven<
852227825Stheraven    is_arithmetic<_A1>::value &&
853227825Stheraven    is_arithmetic<_A2>::value,
854227825Stheraven    typename __promote<_A1, _A2>::type
855227825Stheraven>::type
856241900Sdimfmod(_A1 __x, _A2 __y) _NOEXCEPT
857227825Stheraven{
858227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
859227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
860227825Stheraven                      is_same<_A2, __result_type>::value)), "");
861227825Stheraven    return fmod((__result_type)__x, (__result_type)__y);
862227825Stheraven}
863227825Stheraven
864232924Stheraven
865227825Stheraven// frexp
866227825Stheraven
867227825Stheravenusing ::frexp;
868227825Stheravenusing ::frexpf;
869227825Stheraven
870227825Stheraven#ifndef _MSC_VER
871241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       frexp(float __x, int* __e) _NOEXCEPT       {return frexpf(__x, __e);}
872241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
873227825Stheraven#endif
874227825Stheraven
875227825Stheraventemplate <class _A1>
876227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
877227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
878241900Sdimfrexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
879227825Stheraven
880227825Stheraven// ldexp
881227825Stheraven
882227825Stheravenusing ::ldexp;
883227825Stheravenusing ::ldexpf;
884227825Stheraven
885227825Stheraven#ifndef _MSC_VER
886241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       ldexp(float __x, int __e) _NOEXCEPT       {return ldexpf(__x, __e);}
887241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
888227825Stheraven#endif
889227825Stheraven
890227825Stheraventemplate <class _A1>
891227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
892227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
893241900Sdimldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);}
894227825Stheraven
895227825Stheraven// log
896227825Stheraven
897232924Stheraven#endif // __sun__
898227825Stheravenusing ::log;
899227825Stheravenusing ::logf;
900232924Stheraven#ifndef __sun__
901227825Stheraven
902227825Stheraven#ifndef _MSC_VER
903241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       log(float __x) _NOEXCEPT       {return logf(__x);}
904241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
905227825Stheraven#endif
906227825Stheraven
907227825Stheraventemplate <class _A1>
908227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
909227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
910241900Sdimlog(_A1 __x) _NOEXCEPT {return log((double)__x);}
911227825Stheraven
912232924Stheraven
913227825Stheraven// log10
914227825Stheraven
915227825Stheravenusing ::log10;
916227825Stheravenusing ::log10f;
917227825Stheraven
918227825Stheraven#ifndef _MSC_VER
919241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       log10(float __x) _NOEXCEPT       {return log10f(__x);}
920241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
921227825Stheraven#endif
922227825Stheraven
923227825Stheraventemplate <class _A1>
924227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
925227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
926241900Sdimlog10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
927227825Stheraven
928227825Stheraven// modf
929227825Stheraven
930227825Stheravenusing ::modf;
931227825Stheravenusing ::modff;
932227825Stheraven
933227825Stheraven#ifndef _MSC_VER
934241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       modf(float __x, float* __y) _NOEXCEPT             {return modff(__x, __y);}
935241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
936227825Stheraven#endif
937227825Stheraven
938227825Stheraven// pow
939227825Stheraven
940232924Stheraven#endif // __sun__ 
941227825Stheravenusing ::pow;
942227825Stheravenusing ::powf;
943227825Stheraven
944232924Stheraven#ifndef __sun__
945232924Stheraven
946227825Stheraven#ifndef _MSC_VER
947241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       pow(float __x, float __y) _NOEXCEPT             {return powf(__x, __y);}
948241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
949227825Stheraven#endif
950227825Stheraven
951227825Stheraventemplate <class _A1, class _A2>
952227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
953227825Stheraventypename enable_if
954227825Stheraven<
955227825Stheraven    is_arithmetic<_A1>::value &&
956227825Stheraven    is_arithmetic<_A2>::value,
957227825Stheraven    typename __promote<_A1, _A2>::type
958227825Stheraven>::type
959241900Sdimpow(_A1 __x, _A2 __y) _NOEXCEPT
960227825Stheraven{
961227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
962227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
963227825Stheraven                      is_same<_A2, __result_type>::value)), "");
964227825Stheraven    return pow((__result_type)__x, (__result_type)__y);
965227825Stheraven}
966227825Stheraven
967232924Stheraven
968227825Stheraven// sin
969227825Stheraven
970227825Stheravenusing ::sin;
971227825Stheravenusing ::sinf;
972227825Stheraven
973227825Stheraven#ifndef _MSC_VER
974241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       sin(float __x) _NOEXCEPT       {return sinf(__x);}
975241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
976227825Stheraven#endif
977227825Stheraven
978227825Stheraventemplate <class _A1>
979227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
980227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
981241900Sdimsin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
982227825Stheraven
983227825Stheraven// sinh
984227825Stheraven
985227825Stheravenusing ::sinh;
986227825Stheravenusing ::sinhf;
987227825Stheraven
988227825Stheraven#ifndef _MSC_VER
989241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       sinh(float __x) _NOEXCEPT       {return sinhf(__x);}
990241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
991227825Stheraven#endif
992227825Stheraven
993227825Stheraventemplate <class _A1>
994227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
995227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
996241900Sdimsinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);}
997227825Stheraven
998227825Stheraven// sqrt
999227825Stheraven
1000232924Stheraven#endif // __sun__
1001227825Stheravenusing ::sqrt;
1002227825Stheravenusing ::sqrtf;
1003227825Stheraven
1004232924Stheraven
1005232924Stheraven#if !(defined(_MSC_VER) || defined(__sun__))
1006241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       sqrt(float __x) _NOEXCEPT       {return sqrtf(__x);}
1007241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
1008227825Stheraven#endif
1009227825Stheraven
1010227825Stheraventemplate <class _A1>
1011227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1012227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1013241900Sdimsqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);}
1014227825Stheraven
1015227825Stheraven// tan
1016227825Stheraven
1017227825Stheravenusing ::tan;
1018227825Stheravenusing ::tanf;
1019232924Stheraven#ifndef __sun__
1020227825Stheraven
1021227825Stheraven#ifndef _MSC_VER
1022241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       tan(float __x) _NOEXCEPT       {return tanf(__x);}
1023241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
1024227825Stheraven#endif
1025227825Stheraven
1026227825Stheraventemplate <class _A1>
1027227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1028227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1029241900Sdimtan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
1030227825Stheraven
1031227825Stheraven// tanh
1032227825Stheraven
1033227825Stheravenusing ::tanh;
1034227825Stheravenusing ::tanhf;
1035227825Stheraven
1036227825Stheraven#ifndef _MSC_VER
1037241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       tanh(float __x) _NOEXCEPT       {return tanhf(__x);}
1038241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
1039227825Stheraven#endif
1040227825Stheraven
1041227825Stheraventemplate <class _A1>
1042227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1043227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1044241900Sdimtanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
1045227825Stheraven
1046227825Stheraven// acosh
1047227825Stheraven
1048227825Stheraven#ifndef _MSC_VER
1049227825Stheravenusing ::acosh;
1050227825Stheravenusing ::acoshf;
1051227825Stheraven
1052241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       acosh(float __x) _NOEXCEPT       {return acoshf(__x);}
1053241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);}
1054227825Stheraven
1055227825Stheraventemplate <class _A1>
1056227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1057227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1058241900Sdimacosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
1059227825Stheraven#endif
1060227825Stheraven
1061227825Stheraven// asinh
1062227825Stheraven
1063227825Stheraven#ifndef _MSC_VER
1064227825Stheravenusing ::asinh;
1065227825Stheravenusing ::asinhf;
1066227825Stheraven
1067241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       asinh(float __x) _NOEXCEPT       {return asinhf(__x);}
1068241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);}
1069227825Stheraven
1070227825Stheraventemplate <class _A1>
1071227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1072227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1073241900Sdimasinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
1074227825Stheraven#endif
1075227825Stheraven
1076227825Stheraven// atanh
1077227825Stheraven
1078227825Stheraven#ifndef _MSC_VER
1079227825Stheravenusing ::atanh;
1080227825Stheravenusing ::atanhf;
1081227825Stheraven
1082241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       atanh(float __x) _NOEXCEPT       {return atanhf(__x);}
1083241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);}
1084227825Stheraven
1085227825Stheraventemplate <class _A1>
1086227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1087227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1088241900Sdimatanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
1089227825Stheraven#endif
1090227825Stheraven
1091227825Stheraven// cbrt
1092227825Stheraven
1093227825Stheraven#ifndef _MSC_VER
1094227825Stheravenusing ::cbrt;
1095227825Stheravenusing ::cbrtf;
1096227825Stheraven
1097241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       cbrt(float __x) _NOEXCEPT       {return cbrtf(__x);}
1098241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);}
1099227825Stheraven
1100227825Stheraventemplate <class _A1>
1101227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1102227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1103241900Sdimcbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);}
1104227825Stheraven#endif
1105227825Stheraven
1106227825Stheraven// copysign
1107227825Stheraven
1108227825Stheravenusing ::copysign;
1109227825Stheravenusing ::copysignf;
1110227825Stheraven
1111241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       copysign(float __x, float __y) _NOEXCEPT             {return copysignf(__x, __y);}
1112241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);}
1113227825Stheraven
1114227825Stheraventemplate <class _A1, class _A2>
1115227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1116227825Stheraventypename enable_if
1117227825Stheraven<
1118227825Stheraven    is_arithmetic<_A1>::value &&
1119227825Stheraven    is_arithmetic<_A2>::value,
1120227825Stheraven    typename __promote<_A1, _A2>::type
1121227825Stheraven>::type
1122241900Sdimcopysign(_A1 __x, _A2 __y) _NOEXCEPT
1123227825Stheraven{
1124227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1125227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1126227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1127227825Stheraven    return copysign((__result_type)__x, (__result_type)__y);
1128227825Stheraven}
1129227825Stheraven
1130227825Stheraven#ifndef _MSC_VER
1131227825Stheraven
1132227825Stheraven// erf
1133227825Stheraven
1134227825Stheravenusing ::erf;
1135227825Stheravenusing ::erff;
1136227825Stheraven
1137241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       erf(float __x) _NOEXCEPT       {return erff(__x);}
1138241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);}
1139227825Stheraven
1140227825Stheraventemplate <class _A1>
1141227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1142227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1143241900Sdimerf(_A1 __x) _NOEXCEPT {return erf((double)__x);}
1144227825Stheraven
1145227825Stheraven// erfc
1146227825Stheraven
1147227825Stheravenusing ::erfc;
1148227825Stheravenusing ::erfcf;
1149227825Stheraven
1150241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       erfc(float __x) _NOEXCEPT       {return erfcf(__x);}
1151241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);}
1152227825Stheraven
1153227825Stheraventemplate <class _A1>
1154227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1155227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1156241900Sdimerfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);}
1157227825Stheraven
1158227825Stheraven// exp2
1159227825Stheraven
1160227825Stheravenusing ::exp2;
1161227825Stheravenusing ::exp2f;
1162227825Stheraven
1163241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       exp2(float __x) _NOEXCEPT       {return exp2f(__x);}
1164241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);}
1165227825Stheraven
1166227825Stheraventemplate <class _A1>
1167227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1168227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1169241900Sdimexp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);}
1170227825Stheraven
1171227825Stheraven// expm1
1172227825Stheraven
1173227825Stheravenusing ::expm1;
1174227825Stheravenusing ::expm1f;
1175227825Stheraven
1176241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       expm1(float __x) _NOEXCEPT       {return expm1f(__x);}
1177241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);}
1178227825Stheraven
1179227825Stheraventemplate <class _A1>
1180227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1181227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1182241900Sdimexpm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);}
1183227825Stheraven
1184227825Stheraven// fdim
1185227825Stheraven
1186227825Stheravenusing ::fdim;
1187227825Stheravenusing ::fdimf;
1188227825Stheraven
1189241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       fdim(float __x, float __y) _NOEXCEPT             {return fdimf(__x, __y);}
1190241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);}
1191227825Stheraven
1192227825Stheraventemplate <class _A1, class _A2>
1193227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1194227825Stheraventypename enable_if
1195227825Stheraven<
1196227825Stheraven    is_arithmetic<_A1>::value &&
1197227825Stheraven    is_arithmetic<_A2>::value,
1198227825Stheraven    typename __promote<_A1, _A2>::type
1199227825Stheraven>::type
1200241900Sdimfdim(_A1 __x, _A2 __y) _NOEXCEPT
1201227825Stheraven{
1202227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1203227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1204227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1205227825Stheraven    return fdim((__result_type)__x, (__result_type)__y);
1206227825Stheraven}
1207227825Stheraven
1208227825Stheraven// fma
1209227825Stheraven
1210241900Sdiminline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);}
1211242939Stheraven#ifndef FP_FAST_FMAF
1212227825Stheraven#define FP_FAST_FMAF
1213242939Stheraven#endif
1214227825Stheraven
1215227825Stheravenusing ::fma;
1216227825Stheraven
1217241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       fma(float __x, float __y, float __z) _NOEXCEPT                   {return fmaf(__x, __y, __z);}
1218241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);}
1219227825Stheraven
1220227825Stheraventemplate <class _A1, class _A2, class _A3>
1221227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1222227825Stheraventypename enable_if
1223227825Stheraven<
1224227825Stheraven    is_arithmetic<_A1>::value &&
1225227825Stheraven    is_arithmetic<_A2>::value &&
1226227825Stheraven    is_arithmetic<_A3>::value,
1227227825Stheraven    typename __promote<_A1, _A2, _A3>::type
1228227825Stheraven>::type
1229241900Sdimfma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
1230227825Stheraven{
1231227825Stheraven    typedef typename __promote<_A1, _A2, _A3>::type __result_type;
1232227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1233227825Stheraven                      is_same<_A2, __result_type>::value &&
1234227825Stheraven                      is_same<_A3, __result_type>::value)), "");
1235227825Stheraven    return fma((__result_type)__x, (__result_type)__y, (__result_type)__z);
1236227825Stheraven}
1237227825Stheraven
1238227825Stheraven// fmax
1239227825Stheraven
1240227825Stheravenusing ::fmax;
1241227825Stheravenusing ::fmaxf;
1242227825Stheraven
1243241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       fmax(float __x, float __y) _NOEXCEPT             {return fmaxf(__x, __y);}
1244241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);}
1245227825Stheraven
1246227825Stheraventemplate <class _A1, class _A2>
1247227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1248227825Stheraventypename enable_if
1249227825Stheraven<
1250227825Stheraven    is_arithmetic<_A1>::value &&
1251227825Stheraven    is_arithmetic<_A2>::value,
1252227825Stheraven    typename __promote<_A1, _A2>::type
1253227825Stheraven>::type
1254241900Sdimfmax(_A1 __x, _A2 __y) _NOEXCEPT
1255227825Stheraven{
1256227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1257227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1258227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1259227825Stheraven    return fmax((__result_type)__x, (__result_type)__y);
1260227825Stheraven}
1261227825Stheraven
1262227825Stheraven// fmin
1263227825Stheraven
1264227825Stheravenusing ::fmin;
1265227825Stheravenusing ::fminf;
1266227825Stheraven
1267241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       fmin(float __x, float __y) _NOEXCEPT             {return fminf(__x, __y);}
1268241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);}
1269227825Stheraven
1270227825Stheraventemplate <class _A1, class _A2>
1271227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1272227825Stheraventypename enable_if
1273227825Stheraven<
1274227825Stheraven    is_arithmetic<_A1>::value &&
1275227825Stheraven    is_arithmetic<_A2>::value,
1276227825Stheraven    typename __promote<_A1, _A2>::type
1277227825Stheraven>::type
1278241900Sdimfmin(_A1 __x, _A2 __y) _NOEXCEPT
1279227825Stheraven{
1280227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1281227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1282227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1283227825Stheraven    return fmin((__result_type)__x, (__result_type)__y);
1284227825Stheraven}
1285227825Stheraven
1286227825Stheraven// hypot
1287227825Stheraven
1288227825Stheravenusing ::hypot;
1289227825Stheravenusing ::hypotf;
1290227825Stheraven
1291241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       hypot(float __x, float __y) _NOEXCEPT             {return hypotf(__x, __y);}
1292241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);}
1293227825Stheraven
1294227825Stheraventemplate <class _A1, class _A2>
1295227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1296227825Stheraventypename enable_if
1297227825Stheraven<
1298227825Stheraven    is_arithmetic<_A1>::value &&
1299227825Stheraven    is_arithmetic<_A2>::value,
1300227825Stheraven    typename __promote<_A1, _A2>::type
1301227825Stheraven>::type
1302241900Sdimhypot(_A1 __x, _A2 __y) _NOEXCEPT
1303227825Stheraven{
1304227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1305227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1306227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1307227825Stheraven    return hypot((__result_type)__x, (__result_type)__y);
1308227825Stheraven}
1309227825Stheraven
1310227825Stheraven// ilogb
1311227825Stheraven
1312227825Stheravenusing ::ilogb;
1313227825Stheravenusing ::ilogbf;
1314227825Stheraven
1315241900Sdiminline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT       {return ilogbf(__x);}
1316241900Sdiminline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);}
1317227825Stheraven
1318227825Stheraventemplate <class _A1>
1319227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1320227825Stheraventypename enable_if<is_integral<_A1>::value, int>::type
1321241900Sdimilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);}
1322227825Stheraven
1323227825Stheraven// lgamma
1324227825Stheraven
1325227825Stheravenusing ::lgamma;
1326227825Stheravenusing ::lgammaf;
1327227825Stheraven
1328241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       lgamma(float __x) _NOEXCEPT       {return lgammaf(__x);}
1329241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {return lgammal(__x);}
1330227825Stheraven
1331232924Stheraven
1332227825Stheraventemplate <class _A1>
1333227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1334227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1335241900Sdimlgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);}
1336227825Stheraven
1337232924Stheraven
1338227825Stheraven// llrint
1339227825Stheraven
1340227825Stheravenusing ::llrint;
1341227825Stheravenusing ::llrintf;
1342227825Stheraven
1343241900Sdiminline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT       {return llrintf(__x);}
1344241900Sdiminline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);}
1345227825Stheraven
1346227825Stheraventemplate <class _A1>
1347227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1348227825Stheraventypename enable_if<is_integral<_A1>::value, long long>::type
1349241900Sdimllrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);}
1350227825Stheraven
1351227825Stheraven// llround
1352227825Stheraven
1353227825Stheravenusing ::llround;
1354227825Stheravenusing ::llroundf;
1355227825Stheraven
1356241900Sdiminline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT       {return llroundf(__x);}
1357241900Sdiminline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);}
1358227825Stheraven
1359227825Stheraventemplate <class _A1>
1360227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1361227825Stheraventypename enable_if<is_integral<_A1>::value, long long>::type
1362241900Sdimllround(_A1 __x) _NOEXCEPT {return llround((double)__x);}
1363227825Stheraven
1364227825Stheraven// log1p
1365227825Stheraven
1366227825Stheravenusing ::log1p;
1367227825Stheravenusing ::log1pf;
1368227825Stheraven
1369241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       log1p(float __x) _NOEXCEPT       {return log1pf(__x);}
1370241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);}
1371227825Stheraven
1372227825Stheraventemplate <class _A1>
1373227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1374227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1375241900Sdimlog1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);}
1376227825Stheraven
1377227825Stheraven// log2
1378227825Stheraven
1379227825Stheravenusing ::log2;
1380227825Stheravenusing ::log2f;
1381227825Stheraven
1382241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       log2(float __x) _NOEXCEPT       {return log2f(__x);}
1383241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);}
1384227825Stheraven
1385227825Stheraventemplate <class _A1>
1386227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1387227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1388241900Sdimlog2(_A1 __x) _NOEXCEPT {return log2((double)__x);}
1389227825Stheraven
1390227825Stheraven// logb
1391227825Stheraven
1392227825Stheravenusing ::logb;
1393227825Stheravenusing ::logbf;
1394227825Stheraven
1395241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       logb(float __x) _NOEXCEPT       {return logbf(__x);}
1396241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);}
1397227825Stheraven
1398227825Stheraventemplate <class _A1>
1399227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1400227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1401241900Sdimlogb(_A1 __x) _NOEXCEPT {return logb((double)__x);}
1402227825Stheraven
1403227825Stheraven// lrint
1404227825Stheraven
1405227825Stheravenusing ::lrint;
1406227825Stheravenusing ::lrintf;
1407227825Stheraven
1408241900Sdiminline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT       {return lrintf(__x);}
1409241900Sdiminline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);}
1410227825Stheraven
1411227825Stheraventemplate <class _A1>
1412227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1413227825Stheraventypename enable_if<is_integral<_A1>::value, long>::type
1414241900Sdimlrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);}
1415227825Stheraven
1416227825Stheraven// lround
1417227825Stheraven
1418227825Stheravenusing ::lround;
1419227825Stheravenusing ::lroundf;
1420227825Stheraven
1421241900Sdiminline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT       {return lroundf(__x);}
1422241900Sdiminline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);}
1423227825Stheraven
1424227825Stheraventemplate <class _A1>
1425227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1426227825Stheraventypename enable_if<is_integral<_A1>::value, long>::type
1427241900Sdimlround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
1428227825Stheraven
1429227825Stheraven// nan
1430232924Stheraven#endif // _MSC_VER
1431232924Stheraven#endif // __sun__
1432227825Stheravenusing ::nan;
1433227825Stheravenusing ::nanf;
1434232924Stheraven#ifndef __sun__
1435232924Stheraven#ifndef _MSC_VER
1436227825Stheraven
1437227825Stheraven// nearbyint
1438227825Stheraven
1439227825Stheravenusing ::nearbyint;
1440227825Stheravenusing ::nearbyintf;
1441227825Stheraven
1442241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       nearbyint(float __x) _NOEXCEPT       {return nearbyintf(__x);}
1443241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);}
1444227825Stheraven
1445227825Stheraventemplate <class _A1>
1446227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1447227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1448241900Sdimnearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);}
1449227825Stheraven
1450227825Stheraven// nextafter
1451227825Stheraven
1452227825Stheravenusing ::nextafter;
1453227825Stheravenusing ::nextafterf;
1454227825Stheraven
1455241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       nextafter(float __x, float __y) _NOEXCEPT             {return nextafterf(__x, __y);}
1456241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);}
1457227825Stheraven
1458227825Stheraventemplate <class _A1, class _A2>
1459227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1460227825Stheraventypename enable_if
1461227825Stheraven<
1462227825Stheraven    is_arithmetic<_A1>::value &&
1463227825Stheraven    is_arithmetic<_A2>::value,
1464227825Stheraven    typename __promote<_A1, _A2>::type
1465227825Stheraven>::type
1466241900Sdimnextafter(_A1 __x, _A2 __y) _NOEXCEPT
1467227825Stheraven{
1468227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1469227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1470227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1471227825Stheraven    return nextafter((__result_type)__x, (__result_type)__y);
1472227825Stheraven}
1473227825Stheraven
1474227825Stheraven// nexttoward
1475227825Stheraven
1476227825Stheravenusing ::nexttoward;
1477227825Stheravenusing ::nexttowardf;
1478227825Stheraven
1479241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       nexttoward(float __x, long double __y) _NOEXCEPT       {return nexttowardf(__x, __y);}
1480241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);}
1481227825Stheraven
1482227825Stheraventemplate <class _A1>
1483227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1484227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1485241900Sdimnexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);}
1486227825Stheraven
1487227825Stheraven// remainder
1488227825Stheraven
1489227825Stheravenusing ::remainder;
1490227825Stheravenusing ::remainderf;
1491227825Stheraven
1492241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       remainder(float __x, float __y) _NOEXCEPT             {return remainderf(__x, __y);}
1493241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
1494227825Stheraven
1495227825Stheraventemplate <class _A1, class _A2>
1496227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1497227825Stheraventypename enable_if
1498227825Stheraven<
1499227825Stheraven    is_arithmetic<_A1>::value &&
1500227825Stheraven    is_arithmetic<_A2>::value,
1501227825Stheraven    typename __promote<_A1, _A2>::type
1502227825Stheraven>::type
1503241900Sdimremainder(_A1 __x, _A2 __y) _NOEXCEPT
1504227825Stheraven{
1505227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1506227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1507227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1508227825Stheraven    return remainder((__result_type)__x, (__result_type)__y);
1509227825Stheraven}
1510227825Stheraven
1511227825Stheraven// remquo
1512227825Stheraven
1513227825Stheravenusing ::remquo;
1514227825Stheravenusing ::remquof;
1515227825Stheraven
1516241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       remquo(float __x, float __y, int* __z) _NOEXCEPT             {return remquof(__x, __y, __z);}
1517241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);}
1518227825Stheraven
1519227825Stheraventemplate <class _A1, class _A2>
1520227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1521227825Stheraventypename enable_if
1522227825Stheraven<
1523227825Stheraven    is_arithmetic<_A1>::value &&
1524227825Stheraven    is_arithmetic<_A2>::value,
1525227825Stheraven    typename __promote<_A1, _A2>::type
1526227825Stheraven>::type
1527241900Sdimremquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
1528227825Stheraven{
1529227825Stheraven    typedef typename __promote<_A1, _A2>::type __result_type;
1530227825Stheraven    static_assert((!(is_same<_A1, __result_type>::value &&
1531227825Stheraven                      is_same<_A2, __result_type>::value)), "");
1532227825Stheraven    return remquo((__result_type)__x, (__result_type)__y, __z);
1533227825Stheraven}
1534227825Stheraven
1535227825Stheraven// rint
1536227825Stheraven
1537227825Stheravenusing ::rint;
1538227825Stheravenusing ::rintf;
1539227825Stheraven
1540241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       rint(float __x) _NOEXCEPT       {return rintf(__x);}
1541241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);}
1542227825Stheraven
1543227825Stheraventemplate <class _A1>
1544227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1545227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1546241900Sdimrint(_A1 __x) _NOEXCEPT {return rint((double)__x);}
1547227825Stheraven
1548227825Stheraven// round
1549227825Stheraven
1550227825Stheravenusing ::round;
1551227825Stheravenusing ::roundf;
1552227825Stheraven
1553241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       round(float __x) _NOEXCEPT       {return roundf(__x);}
1554241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
1555227825Stheraven
1556227825Stheraventemplate <class _A1>
1557227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1558227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1559241900Sdimround(_A1 __x) _NOEXCEPT {return round((double)__x);}
1560227825Stheraven
1561227825Stheraven// scalbln
1562227825Stheraven
1563227825Stheravenusing ::scalbln;
1564227825Stheravenusing ::scalblnf;
1565227825Stheraven
1566241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       scalbln(float __x, long __y) _NOEXCEPT       {return scalblnf(__x, __y);}
1567241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);}
1568227825Stheraven
1569227825Stheraventemplate <class _A1>
1570227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1571227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1572241900Sdimscalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);}
1573227825Stheraven
1574227825Stheraven// scalbn
1575227825Stheraven
1576227825Stheravenusing ::scalbn;
1577227825Stheravenusing ::scalbnf;
1578227825Stheraven
1579241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       scalbn(float __x, int __y) _NOEXCEPT       {return scalbnf(__x, __y);}
1580241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);}
1581227825Stheraven
1582227825Stheraventemplate <class _A1>
1583227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1584227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1585241900Sdimscalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);}
1586227825Stheraven
1587227825Stheraven// tgamma
1588227825Stheraven
1589227825Stheravenusing ::tgamma;
1590227825Stheravenusing ::tgammaf;
1591227825Stheraven
1592241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       tgamma(float __x) _NOEXCEPT       {return tgammaf(__x);}
1593241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);}
1594227825Stheraven
1595227825Stheraventemplate <class _A1>
1596227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1597227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1598241900Sdimtgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);}
1599227825Stheraven
1600227825Stheraven// trunc
1601227825Stheraven
1602227825Stheravenusing ::trunc;
1603227825Stheravenusing ::truncf;
1604227825Stheraven
1605241900Sdiminline _LIBCPP_INLINE_VISIBILITY float       trunc(float __x) _NOEXCEPT       {return truncf(__x);}
1606241900Sdiminline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);}
1607227825Stheraven
1608227825Stheraventemplate <class _A1>
1609227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
1610227825Stheraventypename enable_if<is_integral<_A1>::value, double>::type
1611241900Sdimtrunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
1612227825Stheraven
1613227825Stheraven#endif // !_MSC_VER
1614227825Stheraven
1615227825Stheravenusing ::acosl;
1616227825Stheravenusing ::asinl;
1617227825Stheravenusing ::atanl;
1618227825Stheravenusing ::atan2l;
1619227825Stheravenusing ::ceill;
1620227825Stheravenusing ::cosl;
1621227825Stheravenusing ::coshl;
1622227825Stheravenusing ::expl;
1623227825Stheravenusing ::fabsl;
1624227825Stheravenusing ::floorl;
1625227825Stheravenusing ::fmodl;
1626227825Stheravenusing ::frexpl;
1627227825Stheravenusing ::ldexpl;
1628227825Stheravenusing ::logl;
1629227825Stheravenusing ::log10l;
1630227825Stheravenusing ::modfl;
1631227825Stheravenusing ::powl;
1632227825Stheravenusing ::sinl;
1633227825Stheravenusing ::sinhl;
1634227825Stheravenusing ::sqrtl;
1635227825Stheravenusing ::tanl;
1636227825Stheraven#ifndef _MSC_VER
1637227825Stheravenusing ::tanhl;
1638227825Stheravenusing ::acoshl;
1639227825Stheravenusing ::asinhl;
1640227825Stheravenusing ::atanhl;
1641227825Stheravenusing ::cbrtl;
1642232924Stheraven#endif  // !_MSC_VER
1643227825Stheravenusing ::copysignl;
1644227825Stheraven#ifndef _MSC_VER
1645227825Stheravenusing ::erfl;
1646227825Stheravenusing ::erfcl;
1647227825Stheravenusing ::exp2l;
1648227825Stheravenusing ::expm1l;
1649227825Stheravenusing ::fdiml;
1650227825Stheravenusing ::fmal;
1651227825Stheravenusing ::fmaxl;
1652227825Stheravenusing ::fminl;
1653227825Stheravenusing ::hypotl;
1654227825Stheravenusing ::ilogbl;
1655227825Stheravenusing ::lgammal;
1656227825Stheravenusing ::llrintl;
1657227825Stheravenusing ::llroundl;
1658227825Stheravenusing ::log1pl;
1659227825Stheravenusing ::log2l;
1660227825Stheravenusing ::logbl;
1661227825Stheravenusing ::lrintl;
1662227825Stheravenusing ::lroundl;
1663227825Stheravenusing ::nanl;
1664227825Stheravenusing ::nearbyintl;
1665227825Stheravenusing ::nextafterl;
1666227825Stheravenusing ::nexttowardl;
1667227825Stheravenusing ::remainderl;
1668227825Stheravenusing ::remquol;
1669227825Stheravenusing ::rintl;
1670227825Stheravenusing ::roundl;
1671227825Stheravenusing ::scalblnl;
1672227825Stheravenusing ::scalbnl;
1673227825Stheravenusing ::tgammal;
1674227825Stheravenusing ::truncl;
1675227825Stheraven#endif // !_MSC_VER
1676227825Stheraven
1677232924Stheraven#else 
1678232924Stheravenusing ::lgamma;
1679232924Stheravenusing ::lgammaf;
1680232924Stheraven#endif // __sun__
1681227825Stheraven_LIBCPP_END_NAMESPACE_STD
1682227825Stheraven
1683227825Stheraven#endif  // _LIBCPP_CMATH
1684