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_ROOTS_H
0010 #define _LIBCPP___CXX03___MATH_ROOTS_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 // sqrt
0025 
0026 inline _LIBCPP_HIDE_FROM_ABI float sqrt(float __x) _NOEXCEPT { return __builtin_sqrtf(__x); }
0027 
0028 template <class = int>
0029 _LIBCPP_HIDE_FROM_ABI double sqrt(double __x) _NOEXCEPT {
0030   return __builtin_sqrt(__x);
0031 }
0032 
0033 inline _LIBCPP_HIDE_FROM_ABI long double sqrt(long double __x) _NOEXCEPT { return __builtin_sqrtl(__x); }
0034 
0035 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0036 inline _LIBCPP_HIDE_FROM_ABI double sqrt(_A1 __x) _NOEXCEPT {
0037   return __builtin_sqrt((double)__x);
0038 }
0039 
0040 // cbrt
0041 
0042 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT { return __builtin_cbrtf(__x); }
0043 
0044 template <class = int>
0045 _LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT {
0046   return __builtin_cbrt(__x);
0047 }
0048 
0049 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {
0050   return __builtin_cbrtl(__x);
0051 }
0052 
0053 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
0054 _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI double cbrt(_A1 __x) _NOEXCEPT {
0055   return __builtin_cbrt((double)__x);
0056 }
0057 
0058 } // namespace __math
0059 
0060 _LIBCPP_END_NAMESPACE_STD
0061 
0062 #endif // _LIBCPP___CXX03___MATH_ROOTS_H