| 1 |
// (C) Copyright Matt Borland 2022. |
| 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 |
#ifndef BOOST_MATH_CCMATH_ISUNORDERED_HPP |
| 7 |
#define BOOST_MATH_CCMATH_ISUNORDERED_HPP |
| 8 |
|
| 9 |
#include <boost/math/ccmath/detail/config.hpp> |
| 10 |
|
| 11 |
#ifdef BOOST_MATH_NO_CCMATH |
| 12 |
#error "The header <boost/math/isunordered.hpp> can only be used in C++17 and later." |
| 13 |
#endif |
| 14 |
|
| 15 |
#include <boost/math/ccmath/isnan.hpp> |
| 16 |
|
| 17 |
namespace boost::math::ccmath { |
| 18 |
|
| 19 |
template <typename T> |
| 20 |
inline constexpr bool isunordered(const T x, const T y) noexcept |
| 21 |
{ |
| 22 |
if(BOOST_MATH_IS_CONSTANT_EVALUATED(x)) |
| 23 |
{ |
| 24 |
return boost::math::ccmath::isnan(x) || boost::math::ccmath::isnan(y); |
| 25 |
} |
| 26 |
else |
| 27 |
{ |
| 28 |
using std::isunordered; |
| 29 |
return isunordered(x, y); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
} // Namespaces |
| 34 |
|
| 35 |
#endif // BOOST_MATH_CCMATH_ISUNORDERED_HPP |