Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:33

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___CXX03___MATH_LOGARITHMS_H
0010 #define _LIBCPP___CXX03___MATH_LOGARITHMS_H
0011 
0012 #include <__cxx03/__config>
0013 #include <__cxx03/__type_traits/enable_if.h>
0014 #include <__cxx03/__type_traits/is_integral.h>
0015 
0016 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0017 #  pragma GCC system_header
0018 #endif
0019 
0020 _LIBCPP_BEGIN_NAMESPACE_STD
0021 
0022 namespace __math {
0023 
0024 // log
0025 
0026 inline _LIBCPP_HIDE_FROM_ABI float log(float __x) _NOEXCEPT { return __builtin_logf(__x); }
0027 
0028 template <class = int>
0029 _LIBCPP_HIDE_FROM_ABI double log(double __x) _NOEXCEPT {
0030   return __builtin_log(__x);
0031 }
0032 
0033 inline _LIBCPP_HIDE_FROM_ABI long double log(long double __x) _NOEXCEPT { return __builtin_logl(__x); }
0034 
0035 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0036 inline _LIBCPP_HIDE_FROM_ABI double log(_A1 __x) _NOEXCEPT {
0037   return __builtin_log((double)__x);
0038 }
0039 
0040 // log10
0041 
0042 inline _LIBCPP_HIDE_FROM_ABI float log10(float __x) _NOEXCEPT { return __builtin_log10f(__x); }
0043 
0044 template <class = int>
0045 _LIBCPP_HIDE_FROM_ABI double log10(double __x) _NOEXCEPT {
0046   return __builtin_log10(__x);
0047 }
0048 
0049 inline _LIBCPP_HIDE_FROM_ABI long double log10(long double __x) _NOEXCEPT { return __builtin_log10l(__x); }
0050 
0051 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0052 inline _LIBCPP_HIDE_FROM_ABI double log10(_A1 __x) _NOEXCEPT {
0053   return __builtin_log10((double)__x);
0054 }
0055 
0056 // ilogb
0057 
0058 inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT { return __builtin_ilogbf(__x); }
0059 
0060 template <class = int>
0061 _LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT {
0062   return __builtin_ilogb(__x);
0063 }
0064 
0065 inline _LIBCPP_HIDE_FROM_ABI int ilogb(long double __x) _NOEXCEPT { return __builtin_ilogbl(__x); }
0066 
0067 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0068 inline _LIBCPP_HIDE_FROM_ABI int ilogb(_A1 __x) _NOEXCEPT {
0069   return __builtin_ilogb((double)__x);
0070 }
0071 
0072 // log1p
0073 
0074 inline _LIBCPP_HIDE_FROM_ABI float log1p(float __x) _NOEXCEPT { return __builtin_log1pf(__x); }
0075 
0076 template <class = int>
0077 _LIBCPP_HIDE_FROM_ABI double log1p(double __x) _NOEXCEPT {
0078   return __builtin_log1p(__x);
0079 }
0080 
0081 inline _LIBCPP_HIDE_FROM_ABI long double log1p(long double __x) _NOEXCEPT { return __builtin_log1pl(__x); }
0082 
0083 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0084 inline _LIBCPP_HIDE_FROM_ABI double log1p(_A1 __x) _NOEXCEPT {
0085   return __builtin_log1p((double)__x);
0086 }
0087 
0088 // log2
0089 
0090 inline _LIBCPP_HIDE_FROM_ABI float log2(float __x) _NOEXCEPT { return __builtin_log2f(__x); }
0091 
0092 template <class = int>
0093 _LIBCPP_HIDE_FROM_ABI double log2(double __x) _NOEXCEPT {
0094   return __builtin_log2(__x);
0095 }
0096 
0097 inline _LIBCPP_HIDE_FROM_ABI long double log2(long double __x) _NOEXCEPT { return __builtin_log2l(__x); }
0098 
0099 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0100 inline _LIBCPP_HIDE_FROM_ABI double log2(_A1 __x) _NOEXCEPT {
0101   return __builtin_log2((double)__x);
0102 }
0103 
0104 // logb
0105 
0106 inline _LIBCPP_HIDE_FROM_ABI float logb(float __x) _NOEXCEPT { return __builtin_logbf(__x); }
0107 
0108 template <class = int>
0109 _LIBCPP_HIDE_FROM_ABI double logb(double __x) _NOEXCEPT {
0110   return __builtin_logb(__x);
0111 }
0112 
0113 inline _LIBCPP_HIDE_FROM_ABI long double logb(long double __x) _NOEXCEPT { return __builtin_logbl(__x); }
0114 
0115 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0116 inline _LIBCPP_HIDE_FROM_ABI double logb(_A1 __x) _NOEXCEPT {
0117   return __builtin_logb((double)__x);
0118 }
0119 
0120 } // namespace __math
0121 
0122 _LIBCPP_END_NAMESPACE_STD
0123 
0124 #endif // _LIBCPP___CXX03___MATH_LOGARITHMS_H