[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / libcxx / include / __math / roots.h
blobcef376fb008cfa5fb1f420801677cd08f51b7c91
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 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___MATH_ROOTS_H
10 #define _LIBCPP___MATH_ROOTS_H
12 #include <__config>
13 #include <__type_traits/enable_if.h>
14 #include <__type_traits/is_integral.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
18 #endif
20 _LIBCPP_BEGIN_NAMESPACE_STD
22 namespace __math {
24 // sqrt
26 inline _LIBCPP_HIDE_FROM_ABI float sqrt(float __x) _NOEXCEPT { return __builtin_sqrtf(__x); }
28 template <class = int>
29 _LIBCPP_HIDE_FROM_ABI double sqrt(double __x) _NOEXCEPT {
30 return __builtin_sqrt(__x);
33 inline _LIBCPP_HIDE_FROM_ABI long double sqrt(long double __x) _NOEXCEPT { return __builtin_sqrtl(__x); }
35 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
36 inline _LIBCPP_HIDE_FROM_ABI double sqrt(_A1 __x) _NOEXCEPT {
37 return __builtin_sqrt((double)__x);
40 // cbrt
42 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT { return __builtin_cbrtf(__x); }
44 template <class = int>
45 [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT {
46 return __builtin_cbrt(__x);
49 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {
50 return __builtin_cbrtl(__x);
53 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
54 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double cbrt(_A1 __x) _NOEXCEPT {
55 return __builtin_cbrt((double)__x);
58 } // namespace __math
60 _LIBCPP_END_NAMESPACE_STD
62 #endif // _LIBCPP___MATH_ROOTS_H