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