/////////////////////////////////////////////////////////////////////////////// // Copyright 2012 John Maddock. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_MP_COMPARE_HPP #define BOOST_MP_COMPARE_HPP #include // // Comparison operators for number. // namespace boost { namespace multiprecision { namespace default_ops { // // The dispatching mechanism used here to deal with differently typed arguments // could be better replaced with enable_if overloads, but that breaks MSVC-12 // under strange and hard to reproduce circumstances. // template inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq(const B& a, const B& b) { return a.compare(b) == 0; } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(b); return eval_eq(a, t.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(a); return eval_eq(t.backend(), b); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_eq(const T& a, const U& b) { using tag_type = std::integral_constant::value>; return eval_eq_imp(a, b, tag_type()); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt(const B& a, const B& b) { return a.compare(b) < 0; } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(b); return eval_lt(a, t.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(a); return eval_lt(t.backend(), b); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_lt(const T& a, const U& b) { using tag_type = std::integral_constant::value>; return eval_lt_imp(a, b, tag_type()); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const B& a, const B& b) { return a.compare(b) > 0; } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(b); return eval_gt(a, t.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt_imp(const T& a, const U& b, const std::integral_constant&) { typename boost::multiprecision::detail::number_from_backend::type t(a); return eval_gt(t.backend(), b); } template inline BOOST_MP_CXX14_CONSTEXPR bool eval_gt(const T& a, const U& b) { using tag_type = std::integral_constant::value>; return eval_gt_imp(a, b, tag_type()); } } // namespace default_ops namespace detail { template struct is_valid_mixed_compare : public std::integral_constant {}; template struct is_valid_mixed_compare, Val> : public std::is_convertible > {}; template struct is_valid_mixed_compare, number > : public std::integral_constant {}; template struct is_valid_mixed_compare, expression > : public std::is_convertible, number > {}; template struct is_valid_mixed_compare, number > : public std::is_convertible, number > {}; template inline constexpr typename std::enable_if::value != number_kind_floating_point, bool>::type is_unordered_value(const number&) { return false; } template inline #if !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) constexpr #endif typename std::enable_if::value == number_kind_floating_point, bool>::type is_unordered_value(const number& a) { using default_ops::eval_fpclassify; return eval_fpclassify(a.backend()) == FP_NAN; } template inline constexpr typename std::enable_if::value != number_kind_floating_point, bool>::type is_unordered_value(const Arithmetic&) { return false; } template inline #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION BOOST_MP_CXX14_CONSTEXPR #endif typename std::enable_if < number_category < Arithmetic> ::value == number_kind_floating_point, bool> ::type is_unordered_value(const Arithmetic& a) { #ifndef BOOST_MP_NO_CONSTEXPR_DETECTION if (BOOST_MP_IS_CONST_EVALUATED(a)) { return a != a; } else #endif { return (boost::math::isnan)(a); } } template inline constexpr bool is_unordered_comparison(const T& a, const U& b) { return is_unordered_value(a) || is_unordered_value(b); } } // namespace detail template inline BOOST_MP_CXX14_CONSTEXPR bool operator==(const number& a, const number& b) { using default_ops::eval_eq; if (detail::is_unordered_comparison(a, b)) return false; return eval_eq(a.backend(), b.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && !is_number_expression::value, bool>::type operator==(const number& a, const Arithmetic& b) { using default_ops::eval_eq; if (detail::is_unordered_comparison(a, b)) return false; return eval_eq(a.backend(), number::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && !is_number_expression::value, bool>::type operator==(const Arithmetic& a, const number& b) { using default_ops::eval_eq; if (detail::is_unordered_comparison(a, b)) return false; return eval_eq(b.backend(), number::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type operator==(const Arithmetic& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(b); if (detail::is_unordered_comparison(a, t)) return false; return eval_eq(t.backend(), result_type::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator==(const number& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(b); if (detail::is_unordered_comparison(a, t)) return false; return eval_eq(t.backend(), a.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type operator==(const detail::expression& a, const Arithmetic& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(a); if (detail::is_unordered_comparison(t, b)) return false; return eval_eq(t.backend(), result_type::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator==(const detail::expression& a, const number& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(a); if (detail::is_unordered_comparison(t, b)) return false; return eval_eq(t.backend(), b.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type operator==(const detail::expression& a, const detail::expression& b) { using default_ops::eval_eq; typename detail::expression::result_type t(a); typename detail::expression::result_type t2(b); if (detail::is_unordered_comparison(t, t2)) return false; return eval_eq(t.backend(), t2.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator!=(const number& a, const number& b) { using default_ops::eval_eq; if (detail::is_unordered_comparison(a, b)) return true; return !eval_eq(a.backend(), b.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && !is_number_expression::value, bool>::type operator!=(const number& a, const Arithmetic& b) { using default_ops::eval_eq; if (detail::is_unordered_comparison(a, b)) return true; return !eval_eq(a.backend(), number::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && !is_number_expression::value, bool>::type operator!=(const Arithmetic& a, const number& b) { using default_ops::eval_eq; if (detail::is_unordered_comparison(a, b)) return true; return !eval_eq(b.backend(), number::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type operator!=(const Arithmetic& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(b); if (detail::is_unordered_comparison(a, t)) return true; return !eval_eq(t.backend(), result_type::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator!=(const number& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(b); if (detail::is_unordered_comparison(a, t)) return true; return !eval_eq(t.backend(), a.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type operator!=(const detail::expression& a, const Arithmetic& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(a); if (detail::is_unordered_comparison(t, b)) return true; return !eval_eq(t.backend(), result_type::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator!=(const detail::expression& a, const number& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_eq; result_type t(a); if (detail::is_unordered_comparison(t, b)) return true; return !eval_eq(t.backend(), result_type::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type operator!=(const detail::expression& a, const detail::expression& b) { using default_ops::eval_eq; typename detail::expression::result_type t(a); typename detail::expression::result_type t2(b); if (detail::is_unordered_comparison(t, t2)) return true; return !eval_eq(t.backend(), t2.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<(number_category::value != number_kind_complex) && (number_category::value != number_kind_complex), bool>::type operator<(const number& a, const number& b) { using default_ops::eval_lt; if (detail::is_unordered_comparison(a, b)) return false; return eval_lt(a.backend(), b.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator<(const number& a, const Arithmetic& b) { using default_ops::eval_lt; if (detail::is_unordered_comparison(a, b)) return false; return eval_lt(a.backend(), number::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator<(const Arithmetic& a, const number& b) { using default_ops::eval_gt; if (detail::is_unordered_comparison(a, b)) return false; return eval_gt(b.backend(), number::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator<(const Arithmetic& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(b); if (detail::is_unordered_comparison(a, t)) return false; return eval_gt(t.backend(), result_type::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator<(const number& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(b); return a < t; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator<(const detail::expression& a, const Arithmetic& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; result_type t(a); if (detail::is_unordered_comparison(t, b)) return false; return eval_lt(t.backend(), result_type::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator<(const detail::expression& a, const number& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; result_type t(a); return t < b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator<(const detail::expression& a, const detail::expression& b) { using default_ops::eval_lt; typename detail::expression::result_type t(a); typename detail::expression::result_type t2(b); if (detail::is_unordered_comparison(t, t2)) return false; return eval_lt(t.backend(), t2.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<(number_category::value != number_kind_complex) && (number_category::value != number_kind_complex), bool>::type operator>(const number& a, const number& b) { using default_ops::eval_gt; if (detail::is_unordered_comparison(a, b)) return false; return eval_gt(a.backend(), b.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator>(const number& a, const Arithmetic& b) { using default_ops::eval_gt; if (detail::is_unordered_comparison(a, b)) return false; return eval_gt(a.backend(), number::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator>(const Arithmetic& a, const number& b) { using default_ops::eval_lt; if (detail::is_unordered_comparison(a, b)) return false; return eval_lt(b.backend(), number::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator>(const Arithmetic& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; result_type t(b); return a > t; } template inline BOOST_MP_CXX14_CONSTEXPR bool operator>(const number& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; result_type t(b); return a > t; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator>(const detail::expression& a, const Arithmetic& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(a); return t > b; } template inline BOOST_MP_CXX14_CONSTEXPR bool operator>(const detail::expression& a, const number& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(a); return t > b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator>(const detail::expression& a, const detail::expression& b) { using default_ops::eval_gt; typename detail::expression::result_type t(a); typename detail::expression::result_type t2(b); return t > t2; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<(number_category::value != number_kind_complex) && (number_category::value != number_kind_complex), bool>::type operator<=(const number& a, const number& b) { using default_ops::eval_gt; if (detail::is_unordered_comparison(a, b)) return false; return !eval_gt(a.backend(), b.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator<=(const number& a, const Arithmetic& b) { using default_ops::eval_gt; if (detail::is_unordered_comparison(a, b)) return false; return !eval_gt(a.backend(), number::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator<=(const Arithmetic& a, const number& b) { using default_ops::eval_lt; if (detail::is_unordered_comparison(a, b)) return false; return !eval_lt(b.backend(), number::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator<=(const Arithmetic& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; if (detail::is_unordered_value(a) || detail::is_unordered_value(b)) return false; result_type t(b); if (detail::is_unordered_comparison(a, t)) return false; return !eval_lt(t.backend(), result_type::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator<=(const number& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; if (detail::is_unordered_value(a) || detail::is_unordered_value(b)) return false; result_type t(b); return a <= t; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator<=(const detail::expression& a, const Arithmetic& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(a); if (detail::is_unordered_comparison(t, b)) return false; return !eval_gt(t.backend(), result_type::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator<=(const detail::expression& a, const number& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(a); return t <= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator<=(const detail::expression& a, const detail::expression& b) { using default_ops::eval_gt; typename detail::expression::result_type t(a); typename detail::expression::result_type t2(b); if (detail::is_unordered_comparison(t, t2)) return false; return !eval_gt(t.backend(), t2.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<(number_category::value != number_kind_complex) && (number_category::value != number_kind_complex), bool>::type operator>=(const number& a, const number& b) { using default_ops::eval_lt; if (detail::is_unordered_comparison(a, b)) return false; return !eval_lt(a.backend(), b.backend()); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator>=(const number& a, const Arithmetic& b) { using default_ops::eval_lt; if (detail::is_unordered_comparison(a, b)) return false; return !eval_lt(a.backend(), number::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value && (number_category::value != number_kind_complex) && !is_number_expression::value, bool>::type operator>=(const Arithmetic& a, const number& b) { using default_ops::eval_gt; if (detail::is_unordered_comparison(a, b)) return false; return !eval_gt(b.backend(), number::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator>=(const Arithmetic& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(b); if (detail::is_unordered_comparison(a, t)) return false; return !eval_gt(t.backend(), result_type::canonical_value(a)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator>=(const number& a, const detail::expression& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_gt; result_type t(b); return a >= t; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator>=(const detail::expression& a, const Arithmetic& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; result_type t(a); if (detail::is_unordered_comparison(t, b)) return false; return !eval_lt(t.backend(), result_type::canonical_value(b)); } template inline BOOST_MP_CXX14_CONSTEXPR bool operator>=(const detail::expression& a, const number& b) { using result_type = typename detail::expression::result_type; using default_ops::eval_lt; result_type t(a); return t >= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value && (number_category::result_type>::value != number_kind_complex), bool>::type operator>=(const detail::expression& a, const detail::expression& b) { using default_ops::eval_lt; typename detail::expression::result_type t(a); typename detail::expression::result_type t2(b); if (detail::is_unordered_comparison(t, t2)) return false; return !eval_lt(t.backend(), t2.backend()); } // // C99 comparison macros as functions: // template inline BOOST_MP_CXX14_CONSTEXPR bool isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const number& b) { return a > b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const Arithmetic& b) { return a > b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const number& b) { return a > b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const detail::expression& b) { return a > b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const Arithmetic& b) { return a > b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type isgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const detail::expression& b) { return a > b; } template inline BOOST_MP_CXX14_CONSTEXPR bool isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const number& b) { return a >= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const Arithmetic& b) { return a >= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const number& b) { return a >= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const detail::expression& b) { return a >= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const Arithmetic& b) { return a >= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const detail::expression& b) { return a >= b; } template inline BOOST_MP_CXX14_CONSTEXPR bool islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const number& b) { return a <= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const Arithmetic& b) { return a <= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const number& b) { return a <= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const detail::expression& b) { return a <= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const Arithmetic& b) { return a <= b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type islessequal BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const detail::expression& b) { return a <= b; } template inline BOOST_MP_CXX14_CONSTEXPR bool isless BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const number& b) { return a < b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isless BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const Arithmetic& b) { return a < b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isless BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const number& b) { return a < b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isless BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const detail::expression& b) { return a < b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isless BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const Arithmetic& b) { return a < b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type isless BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& a, const detail::expression& b) { return a < b; } template inline BOOST_MP_CXX14_CONSTEXPR bool islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const number& b) { if (detail::is_unordered_comparison(a, b)) return false; return a != b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const Arithmetic& b) { if (detail::is_unordered_comparison(a, b)) return false; return a != b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const number& b) { if (detail::is_unordered_comparison(a, b)) return false; return a != b; } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const detail::expression& bb) { typename detail::expression::result_type b(bb); return islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& aa, const Arithmetic& b) { typename detail::expression::result_type a(aa); return islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& aa, const detail::expression& bb) { typename detail::expression::result_type a(aa); typename detail::expression::result_type b(bb); return islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR bool isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const number& b) { return detail::is_unordered_comparison(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(const number& a, const Arithmetic& b) { return detail::is_unordered_comparison(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if, Arithmetic>::value, bool>::type isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const number& b) { return detail::is_unordered_comparison(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(const Arithmetic& a, const detail::expression& bb) { typename detail::expression::result_type b(bb); return detail::is_unordered_comparison(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, Arithmetic>::value, bool>::type isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& aa, const Arithmetic& b) { typename detail::expression::result_type a(aa); return detail::is_unordered_comparison(a, b); } template inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if::result_type, typename detail::expression::result_type>::value, bool>::type isunordered BOOST_PREVENT_MACRO_SUBSTITUTION(const detail::expression& aa, const detail::expression& bb) { typename detail::expression::result_type a(aa); typename detail::expression::result_type b(bb); return detail::is_unordered_comparison(a, b); } }} // namespace boost::multiprecision #endif // BOOST_MP_COMPARE_HPP