diff options
Diffstat (limited to 'contrib/libc++/include/cmath')
-rw-r--r-- | contrib/libc++/include/cmath | 102 |
1 files changed, 69 insertions, 33 deletions
diff --git a/contrib/libc++/include/cmath b/contrib/libc++/include/cmath index b3e9594..7249356 100644 --- a/contrib/libc++/include/cmath +++ b/contrib/libc++/include/cmath @@ -331,7 +331,6 @@ using ::double_t; using ::abs; #endif -#ifndef __sun__ using ::acos; using ::acosf; using ::asin; @@ -346,58 +345,47 @@ using ::cos; using ::cosf; using ::cosh; using ::coshf; -#endif // __sun__ using ::exp; using ::expf; -#ifndef __sun__ using ::fabs; using ::fabsf; using ::floor; using ::floorf; -#endif //__sun__ using ::fmod; using ::fmodf; -#ifndef __sun__ using ::frexp; using ::frexpf; using ::ldexp; using ::ldexpf; -#endif // __sun__ using ::log; using ::logf; -#ifndef __sun__ using ::log10; using ::log10f; using ::modf; using ::modff; -#endif // __sun__ using ::pow; using ::powf; -#ifndef __sun__ using ::sin; using ::sinf; using ::sinh; using ::sinhf; -#endif // __sun__ using ::sqrt; using ::sqrtf; using ::tan; using ::tanf; -#ifndef __sun__ using ::tanh; using ::tanhf; -#ifndef _LIBCPP_MSVCRT using ::acosh; using ::acoshf; using ::asinh; @@ -406,7 +394,6 @@ using ::atanh; using ::atanhf; using ::cbrt; using ::cbrtf; -#endif using ::copysign; using ::copysignf; @@ -449,14 +436,10 @@ using ::lrintf; using ::lround; using ::lroundf; #endif // _LIBCPP_MSVCRT -#endif // __sun__ -#ifndef _LIBCPP_MSVCRT using ::nan; using ::nanf; -#endif // _LIBCPP_MSVCRT -#ifndef __sun__ #ifndef _LIBCPP_MSVCRT using ::nearbyint; using ::nearbyintf; @@ -504,13 +487,11 @@ using ::sinhl; using ::sqrtl; using ::tanl; -#ifndef _LIBCPP_MSVCRT using ::tanhl; using ::acoshl; using ::asinhl; using ::atanhl; using ::cbrtl; -#endif // !_LIBCPP_MSVCRT using ::copysignl; @@ -547,11 +528,6 @@ using ::tgammal; using ::truncl; #endif // !_LIBCPP_MSVCRT -#else -using ::lgamma; -using ::lgammaf; -#endif // __sun__ - #if _LIBCPP_STD_VER > 14 inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); } inline _LIBCPP_INLINE_VISIBILITY double hypot( double x, double y, double z ) { return sqrt(x*x + y*y + z*z); } @@ -559,23 +535,83 @@ inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double x, long double y template <class _A1, class _A2, class _A3> inline _LIBCPP_INLINE_VISIBILITY -typename std::__lazy_enable_if +typename __lazy_enable_if < - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value && - std::is_arithmetic<_A3>::value, - std::__promote<_A1, _A2, _A3> + is_arithmetic<_A1>::value && + is_arithmetic<_A2>::value && + is_arithmetic<_A3>::value, + __promote<_A1, _A2, _A3> >::type hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT { - typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; - static_assert((!(std::is_same<_A1, __result_type>::value && - std::is_same<_A2, __result_type>::value && - std::is_same<_A3, __result_type>::value)), ""); + typedef typename __promote<_A1, _A2, _A3>::type __result_type; + static_assert((!(is_same<_A1, __result_type>::value && + is_same<_A2, __result_type>::value && + is_same<_A3, __result_type>::value)), ""); return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); } #endif +template <class _A1> +_LIBCPP_ALWAYS_INLINE +_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type +__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT +{ +#if __has_builtin(__builtin_isnan) + return __builtin_isnan(__lcpp_x); +#else + return isnan(__lcpp_x); +#endif +} + +template <class _A1> +_LIBCPP_ALWAYS_INLINE +_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type +__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT +{ + return isnan(__lcpp_x); +} + +template <class _A1> +_LIBCPP_ALWAYS_INLINE +_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type +__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT +{ +#if __has_builtin(__builtin_isinf) + return __builtin_isinf(__lcpp_x); +#else + return isinf(__lcpp_x); +#endif +} + +template <class _A1> +_LIBCPP_ALWAYS_INLINE +_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type +__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT +{ + return isinf(__lcpp_x); +} + +template <class _A1> +_LIBCPP_ALWAYS_INLINE +_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type +__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT +{ +#if __has_builtin(__builtin_isfinite) + return __builtin_isfinite(__lcpp_x); +#else + return isfinite(__lcpp_x); +#endif +} + +template <class _A1> +_LIBCPP_ALWAYS_INLINE +_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type +__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT +{ + return isfinite(__lcpp_x); +} + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_CMATH |