Debian Codegraph @

third-party/boost-math/include/boost/math/ccmath/fabs.hpp

raw
1 // (C) Copyright Matt Borland 2021.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 //
6 // Constepxr implementation of fabs (see c.math.abs secion 26.8.2 of the ISO standard)
7
8 #ifndef BOOST_MATH_CCMATH_FABS
9 #define BOOST_MATH_CCMATH_FABS
10
11 #include <boost/math/ccmath/detail/config.hpp>
12
13 #ifdef BOOST_MATH_NO_CCMATH
14 #error "The header <boost/math/fabs.hpp> can only be used in C++17 and later."
15 #endif
16
17 #include <boost/math/ccmath/abs.hpp>
18
19 namespace boost::math::ccmath {
20
21 template <typename T>
22 inline constexpr auto fabs(T x) noexcept
23 {
24 return boost::math::ccmath::abs(x);
25 }
26
27 inline constexpr float fabsf(float x) noexcept
28 {
29 return boost::math::ccmath::abs(x);
30 }
31
32 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
33 inline constexpr long double fabsl(long double x) noexcept
34 {
35 return boost::math::ccmath::abs(x);
36 }
37 #endif
38
39 }
40
41 #endif // BOOST_MATH_CCMATH_FABS