| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef _LIBCPP___MATH_INVERSE_HYPERBOLIC_FUNCTIONS_H |
| 10 | #define _LIBCPP___MATH_INVERSE_HYPERBOLIC_FUNCTIONS_H |
| 11 | |
| 12 | #include <__config> |
| 13 | #include <__type_traits/enable_if.h> |
| 14 | #include <__type_traits/is_integral.h> |
| 15 | |
| 16 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 17 | # pragma GCC system_header |
| 18 | #endif |
| 19 | |
| 20 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 21 | |
| 22 | namespace __math { |
| 23 | |
| 24 | // acosh |
| 25 | |
| 26 | inline _LIBCPP_HIDE_FROM_ABI float acosh(float __x) _NOEXCEPT { return __builtin_acoshf(__x); } |
| 27 | |
| 28 | template <class = int> |
| 29 | _LIBCPP_HIDE_FROM_ABI double acosh(double __x) _NOEXCEPT { |
| 30 | return __builtin_acosh(__x); |
| 31 | } |
| 32 | |
| 33 | inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT { return __builtin_acoshl(__x); } |
| 34 | |
| 35 | template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> |
| 36 | inline _LIBCPP_HIDE_FROM_ABI double acosh(_A1 __x) _NOEXCEPT { |
| 37 | return __builtin_acosh((double)__x); |
| 38 | } |
| 39 | |
| 40 | // asinh |
| 41 | |
| 42 | inline _LIBCPP_HIDE_FROM_ABI float asinh(float __x) _NOEXCEPT { return __builtin_asinhf(__x); } |
| 43 | |
| 44 | template <class = int> |
| 45 | _LIBCPP_HIDE_FROM_ABI double asinh(double __x) _NOEXCEPT { |
| 46 | return __builtin_asinh(__x); |
| 47 | } |
| 48 | |
| 49 | inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT { return __builtin_asinhl(__x); } |
| 50 | |
| 51 | template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> |
| 52 | inline _LIBCPP_HIDE_FROM_ABI double asinh(_A1 __x) _NOEXCEPT { |
| 53 | return __builtin_asinh((double)__x); |
| 54 | } |
| 55 | |
| 56 | // atanh |
| 57 | |
| 58 | inline _LIBCPP_HIDE_FROM_ABI float atanh(float __x) _NOEXCEPT { return __builtin_atanhf(__x); } |
| 59 | |
| 60 | template <class = int> |
| 61 | _LIBCPP_HIDE_FROM_ABI double atanh(double __x) _NOEXCEPT { |
| 62 | return __builtin_atanh(__x); |
| 63 | } |
| 64 | |
| 65 | inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT { return __builtin_atanhl(__x); } |
| 66 | |
| 67 | template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0> |
| 68 | inline _LIBCPP_HIDE_FROM_ABI double atanh(_A1 __x) _NOEXCEPT { |
| 69 | return __builtin_atanh((double)__x); |
| 70 | } |
| 71 | |
| 72 | } // namespace __math |
| 73 | |
| 74 | _LIBCPP_END_NAMESPACE_STD |
| 75 | |
| 76 | #endif // _LIBCPP___MATH_INVERSE_HYPERBOLIC_FUNCTIONS_H |
| 77 |