Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:39:32

0001 //  (C) Copyright Matt Borland 2021.
0002 //  Use, modification and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_MATH_CCMATH_ISNAN
0007 #define BOOST_MATH_CCMATH_ISNAN
0008 
0009 #include <boost/math/special_functions/fpclassify.hpp>
0010 #include <boost/math/ccmath/detail/config.hpp>
0011 
0012 #ifdef BOOST_MATH_NO_CCMATH
0013 #error "The header <boost/math/isnan.hpp> can only be used in C++17 and later."
0014 #endif
0015 
0016 namespace boost::math::ccmath {
0017 
0018 template <typename T>
0019 inline constexpr bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION(T x)
0020 {
0021     if(BOOST_MATH_IS_CONSTANT_EVALUATED(x))
0022     {
0023         return x != x;
0024     }
0025     else
0026     {
0027         using boost::math::isnan;
0028 
0029         if constexpr (!std::is_integral_v<T>)
0030         {
0031             return (isnan)(x);
0032         }
0033         else
0034         {
0035             return (isnan)(static_cast<double>(x));
0036         }
0037     }
0038 }
0039 
0040 }
0041 
0042 #endif // BOOST_MATH_CCMATH_ISNAN