Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / include / __math / error_functions.h
blob6b528bb290001a36170c6b1bea94c95b8d3b79f1
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_ERROR_FUNCTIONS_H
10 #define _LIBCPP___MATH_ERROR_FUNCTIONS_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 // erf
26 inline _LIBCPP_HIDE_FROM_ABI float erf(float __x) _NOEXCEPT { return __builtin_erff(__x); }
28 template <class = int>
29 _LIBCPP_HIDE_FROM_ABI double erf(double __x) _NOEXCEPT {
30 return __builtin_erf(__x);
33 inline _LIBCPP_HIDE_FROM_ABI long double erf(long double __x) _NOEXCEPT { return __builtin_erfl(__x); }
35 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
36 inline _LIBCPP_HIDE_FROM_ABI double erf(_A1 __x) _NOEXCEPT {
37 return __builtin_erf((double)__x);
40 // erfc
42 inline _LIBCPP_HIDE_FROM_ABI float erfc(float __x) _NOEXCEPT { return __builtin_erfcf(__x); }
44 template <class = int>
45 _LIBCPP_HIDE_FROM_ABI double erfc(double __x) _NOEXCEPT {
46 return __builtin_erfc(__x);
49 inline _LIBCPP_HIDE_FROM_ABI long double erfc(long double __x) _NOEXCEPT { return __builtin_erfcl(__x); }
51 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
52 inline _LIBCPP_HIDE_FROM_ABI double erfc(_A1 __x) _NOEXCEPT {
53 return __builtin_erfc((double)__x);
56 } // namespace __math
58 _LIBCPP_END_NAMESPACE_STD
60 #endif // _LIBCPP___MATH_ERROR_FUNCTIONS_H