1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___MATH_HYPERBOLIC_FUNCTIONS_H
10 #define _LIBCPP___MATH_HYPERBOLIC_FUNCTIONS_H
12 #include <__cxx03/__config>
13 #include <__cxx03/__type_traits/enable_if.h>
14 #include <__cxx03/__type_traits/is_integral.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
20 _LIBCPP_BEGIN_NAMESPACE_STD
26 inline _LIBCPP_HIDE_FROM_ABI
float cosh(float __x
) _NOEXCEPT
{ return __builtin_coshf(__x
); }
28 template <class = int>
29 _LIBCPP_HIDE_FROM_ABI
double cosh(double __x
) _NOEXCEPT
{
30 return __builtin_cosh(__x
);
33 inline _LIBCPP_HIDE_FROM_ABI
long double cosh(long double __x
) _NOEXCEPT
{ return __builtin_coshl(__x
); }
35 template <class _A1
, __enable_if_t
<is_integral
<_A1
>::value
, int> = 0>
36 inline _LIBCPP_HIDE_FROM_ABI
double cosh(_A1 __x
) _NOEXCEPT
{
37 return __builtin_cosh((double)__x
);
42 inline _LIBCPP_HIDE_FROM_ABI
float sinh(float __x
) _NOEXCEPT
{ return __builtin_sinhf(__x
); }
44 template <class = int>
45 _LIBCPP_HIDE_FROM_ABI
double sinh(double __x
) _NOEXCEPT
{
46 return __builtin_sinh(__x
);
49 inline _LIBCPP_HIDE_FROM_ABI
long double sinh(long double __x
) _NOEXCEPT
{ return __builtin_sinhl(__x
); }
51 template <class _A1
, __enable_if_t
<is_integral
<_A1
>::value
, int> = 0>
52 inline _LIBCPP_HIDE_FROM_ABI
double sinh(_A1 __x
) _NOEXCEPT
{
53 return __builtin_sinh((double)__x
);
58 inline _LIBCPP_HIDE_FROM_ABI
float tanh(float __x
) _NOEXCEPT
{ return __builtin_tanhf(__x
); }
60 template <class = int>
61 _LIBCPP_HIDE_FROM_ABI
double tanh(double __x
) _NOEXCEPT
{
62 return __builtin_tanh(__x
);
65 inline _LIBCPP_HIDE_FROM_ABI
long double tanh(long double __x
) _NOEXCEPT
{ return __builtin_tanhl(__x
); }
67 template <class _A1
, __enable_if_t
<is_integral
<_A1
>::value
, int> = 0>
68 inline _LIBCPP_HIDE_FROM_ABI
double tanh(_A1 __x
) _NOEXCEPT
{
69 return __builtin_tanh((double)__x
);
74 _LIBCPP_END_NAMESPACE_STD
76 #endif // _LIBCPP___MATH_HYPERBOLIC_FUNCTIONS_H