From 6d49c55cc0a4dd390ad7c0939e5316781e9be3a3 Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Mon, 18 Jul 2022 10:49:12 -0400 Subject: [PATCH] Allow for getting base val from mcx<boost::multiprecision> --- include/teqp/types.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/teqp/types.hpp b/include/teqp/types.hpp index c9ab7ba..1ddde22 100644 --- a/include/teqp/types.hpp +++ b/include/teqp/types.hpp @@ -76,7 +76,18 @@ namespace teqp { return expr.real(); } else if constexpr (is_mcx_t<T>()) { +#if defined(TEQP_MULTIPRECISION_ENABLED) + // Argument is a multicomplex of a boost multiprecision + using contained_type = decltype(expr.real()); + if constexpr (boost::multiprecision::is_number<contained_type>()) { + return static_cast<double>(expr.real()); + } + else { + return expr.real(); + } +#else return expr.real(); +#endif } #if defined(TEQP_MULTIPRECISION_ENABLED) else if constexpr (boost::multiprecision::is_number<T>()) { -- GitLab