DxLibEx
abs.hpp
Go to the documentation of this file.
1 /*=============================================================================
2  Copyright (c) 2011-2016 Bolero MURAKAMI
3  https://github.com/bolero-MURAKAMI/Sprout
4  Copyright (C) 2015-2017 DxLibEx project
5  https://github.com/Nagarei/DxLibEx/
6 
7  Distributed under the Boost Software License, Version 1.0.
8  (See http://www.boost.org/LICENSE_1_0.txt)
9 =============================================================================*/
10 #ifndef DXLE_INC_MATH_ABS_HPP_
11 #define DXLE_INC_MATH_ABS_HPP_
12 #include "dxlibex/config/defines.h"
13 #include <cmath>
15 #include "dxlibex/math/isnan.hpp"
16 #include "dxlibex/math/fabs.hpp"
17 #ifdef DXLE_NO_CXX11_CONSTEXPR
18 namespace dxle{
19  namespace math{
20  using std::abs;
21  }
22  using dxle::math::abs;
23 }
24 #else //DXLE_NO_CXX11_CONSTEXPR
25 namespace dxle {
26  namespace math {
27  template<typename FloatType, enable_if_t<std::is_floating_point<FloatType>::value, std::nullptr_t> = nullptr>
28  inline DXLE_CONSTEXPR FloatType abs(FloatType x) DXLE_NOEXCEPT_OR_NOTHROW
29  {
30  return dxle::math::fabs(x);
31  }
32  } // namespace math
33 
34  using dxle::math::abs;
35 } // namespace dxle
36 #endif //DXLE_NO_CXX11_CONSTEXPR
37 #endif //DXLE_INC_MATH_ABS_HPP_
#define DXLE_CONSTEXPR
Definition: suffix.hpp:21
Definition: cast_if.hpp:12
DXLE_CONSTEXPR FloatType abs(FloatType x) DXLE_NOEXCEPT_OR_NOTHROW
Definition: abs.hpp:28
DXLE_CONSTEXPR FloatType fabs(FloatType x) DXLE_NOEXCEPT_OR_NOTHROW
Definition: fabs.hpp:27
#define DXLE_NOEXCEPT_OR_NOTHROW
Definition: suffix.hpp:94