43 lines · plain
1// (C) Copyright Matt Borland 2022.2// Use, modification and distribution are subject to the3// Boost Software License, Version 1.0. (See accompanying file4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)5 6#ifndef BOOST_MATH_CCMATH_ISLESS_HPP7#define BOOST_MATH_CCMATH_ISLESS_HPP8 9#include <boost/math/ccmath/detail/config.hpp>10 11#ifdef BOOST_MATH_NO_CCMATH12#error "The header <boost/math/isless.hpp> can only be used in C++17 and later."13#endif14 15#include <boost/math/ccmath/isnan.hpp>16 17namespace boost::math::ccmath {18 19template <typename T1, typename T2 = T1>20inline constexpr bool isless(T1 x, T2 y) noexcept21{22 if (BOOST_MATH_IS_CONSTANT_EVALUATED(x))23 {24 if (boost::math::ccmath::isnan(x) || boost::math::ccmath::isnan(y))25 {26 return false;27 }28 else29 {30 return x < y;31 }32 }33 else34 {35 using std::isless;36 return isless(x, y);37 }38}39 40} // Namespaces41 42#endif // BOOST_MATH_CCMATH_ISLESS_HPP43