File indexing completed on 2026-05-03 08:13:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _LIBCPP___CXX03___MATH_EXPONENTIAL_FUNCTIONS_H
0010 #define _LIBCPP___CXX03___MATH_EXPONENTIAL_FUNCTIONS_H
0011
0012 #include <__cxx03/__config>
0013 #include <__cxx03/__type_traits/enable_if.h>
0014 #include <__cxx03/__type_traits/is_arithmetic.h>
0015 #include <__cxx03/__type_traits/is_integral.h>
0016 #include <__cxx03/__type_traits/is_same.h>
0017 #include <__cxx03/__type_traits/promote.h>
0018
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 # pragma GCC system_header
0021 #endif
0022
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024
0025 namespace __math {
0026
0027
0028
0029 inline _LIBCPP_HIDE_FROM_ABI float exp(float __x) _NOEXCEPT { return __builtin_expf(__x); }
0030
0031 template <class = int>
0032 _LIBCPP_HIDE_FROM_ABI double exp(double __x) _NOEXCEPT {
0033 return __builtin_exp(__x);
0034 }
0035
0036 inline _LIBCPP_HIDE_FROM_ABI long double exp(long double __x) _NOEXCEPT { return __builtin_expl(__x); }
0037
0038 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0039 inline _LIBCPP_HIDE_FROM_ABI double exp(_A1 __x) _NOEXCEPT {
0040 return __builtin_exp((double)__x);
0041 }
0042
0043
0044
0045 inline _LIBCPP_HIDE_FROM_ABI float frexp(float __x, int* __e) _NOEXCEPT { return __builtin_frexpf(__x, __e); }
0046
0047 template <class = int>
0048 _LIBCPP_HIDE_FROM_ABI double frexp(double __x, int* __e) _NOEXCEPT {
0049 return __builtin_frexp(__x, __e);
0050 }
0051
0052 inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __e) _NOEXCEPT {
0053 return __builtin_frexpl(__x, __e);
0054 }
0055
0056 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0057 inline _LIBCPP_HIDE_FROM_ABI double frexp(_A1 __x, int* __e) _NOEXCEPT {
0058 return __builtin_frexp((double)__x, __e);
0059 }
0060
0061
0062
0063 inline _LIBCPP_HIDE_FROM_ABI float ldexp(float __x, int __e) _NOEXCEPT { return __builtin_ldexpf(__x, __e); }
0064
0065 template <class = int>
0066 _LIBCPP_HIDE_FROM_ABI double ldexp(double __x, int __e) _NOEXCEPT {
0067 return __builtin_ldexp(__x, __e);
0068 }
0069
0070 inline _LIBCPP_HIDE_FROM_ABI long double ldexp(long double __x, int __e) _NOEXCEPT {
0071 return __builtin_ldexpl(__x, __e);
0072 }
0073
0074 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0075 inline _LIBCPP_HIDE_FROM_ABI double ldexp(_A1 __x, int __e) _NOEXCEPT {
0076 return __builtin_ldexp((double)__x, __e);
0077 }
0078
0079
0080
0081 inline _LIBCPP_HIDE_FROM_ABI float exp2(float __x) _NOEXCEPT { return __builtin_exp2f(__x); }
0082
0083 template <class = int>
0084 _LIBCPP_HIDE_FROM_ABI double exp2(double __x) _NOEXCEPT {
0085 return __builtin_exp2(__x);
0086 }
0087
0088 inline _LIBCPP_HIDE_FROM_ABI long double exp2(long double __x) _NOEXCEPT { return __builtin_exp2l(__x); }
0089
0090 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0091 inline _LIBCPP_HIDE_FROM_ABI double exp2(_A1 __x) _NOEXCEPT {
0092 return __builtin_exp2((double)__x);
0093 }
0094
0095
0096
0097 inline _LIBCPP_HIDE_FROM_ABI float expm1(float __x) _NOEXCEPT { return __builtin_expm1f(__x); }
0098
0099 template <class = int>
0100 _LIBCPP_HIDE_FROM_ABI double expm1(double __x) _NOEXCEPT {
0101 return __builtin_expm1(__x);
0102 }
0103
0104 inline _LIBCPP_HIDE_FROM_ABI long double expm1(long double __x) _NOEXCEPT { return __builtin_expm1l(__x); }
0105
0106 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0107 inline _LIBCPP_HIDE_FROM_ABI double expm1(_A1 __x) _NOEXCEPT {
0108 return __builtin_expm1((double)__x);
0109 }
0110
0111
0112
0113 inline _LIBCPP_HIDE_FROM_ABI float scalbln(float __x, long __y) _NOEXCEPT { return __builtin_scalblnf(__x, __y); }
0114
0115 template <class = int>
0116 _LIBCPP_HIDE_FROM_ABI double scalbln(double __x, long __y) _NOEXCEPT {
0117 return __builtin_scalbln(__x, __y);
0118 }
0119
0120 inline _LIBCPP_HIDE_FROM_ABI long double scalbln(long double __x, long __y) _NOEXCEPT {
0121 return __builtin_scalblnl(__x, __y);
0122 }
0123
0124 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0125 inline _LIBCPP_HIDE_FROM_ABI double scalbln(_A1 __x, long __y) _NOEXCEPT {
0126 return __builtin_scalbln((double)__x, __y);
0127 }
0128
0129
0130
0131 inline _LIBCPP_HIDE_FROM_ABI float scalbn(float __x, int __y) _NOEXCEPT { return __builtin_scalbnf(__x, __y); }
0132
0133 template <class = int>
0134 _LIBCPP_HIDE_FROM_ABI double scalbn(double __x, int __y) _NOEXCEPT {
0135 return __builtin_scalbn(__x, __y);
0136 }
0137
0138 inline _LIBCPP_HIDE_FROM_ABI long double scalbn(long double __x, int __y) _NOEXCEPT {
0139 return __builtin_scalbnl(__x, __y);
0140 }
0141
0142 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0143 inline _LIBCPP_HIDE_FROM_ABI double scalbn(_A1 __x, int __y) _NOEXCEPT {
0144 return __builtin_scalbn((double)__x, __y);
0145 }
0146
0147
0148
0149 inline _LIBCPP_HIDE_FROM_ABI float pow(float __x, float __y) _NOEXCEPT { return __builtin_powf(__x, __y); }
0150
0151 template <class = int>
0152 _LIBCPP_HIDE_FROM_ABI double pow(double __x, double __y) _NOEXCEPT {
0153 return __builtin_pow(__x, __y);
0154 }
0155
0156 inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _NOEXCEPT {
0157 return __builtin_powl(__x, __y);
0158 }
0159
0160 template <class _A1, class _A2, __enable_if_t<is_arithmetic<_A1>::value && is_arithmetic<_A2>::value, int> = 0>
0161 inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type pow(_A1 __x, _A2 __y) _NOEXCEPT {
0162 using __result_type = typename __promote<_A1, _A2>::type;
0163 static_assert(!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value), "");
0164 return __math::pow((__result_type)__x, (__result_type)__y);
0165 }
0166
0167 }
0168
0169 _LIBCPP_END_NAMESPACE_STD
0170
0171 #endif