diff --git a/include/boost/multiprecision/detail/default_ops.hpp b/include/boost/multiprecision/detail/default_ops.hpp index 07fb02b8..c829eea9 100644 --- a/include/boost/multiprecision/detail/default_ops.hpp +++ b/include/boost/multiprecision/detail/default_ops.hpp @@ -3153,7 +3153,7 @@ func(const number& arg, const number& a)\ }\ template \ inline typename enable_if_c<\ - (number_category::value == category) && (number_category >::value == category),\ + (number_category::value == category) && (boost::is_convertible::result_type, number >::value),\ detail::expression<\ detail::function\ , detail::BOOST_JOIN(category, BOOST_JOIN(func, _funct)) \ @@ -3175,7 +3175,7 @@ func(const number& arg, const detail::expression \ inline typename enable_if_c<\ - (number_category::value == category) && (number_category >::value == category),\ + (number_category::value == category) && (boost::is_convertible::result_type, number >::value),\ detail::expression<\ detail::function\ , detail::BOOST_JOIN(category, BOOST_JOIN(func, _funct)) \ diff --git a/test/test_arithmetic.hpp b/test/test_arithmetic.hpp index c6837e9d..9af08178 100644 --- a/test/test_arithmetic.hpp +++ b/test/test_arithmetic.hpp @@ -2266,6 +2266,12 @@ typename boost::enable_if_c::value a = pow(r, c + 0); BOOST_CHECK_CLOSE_FRACTION(real_type("-8.8931513442797186948734782808862447235385767991868219480917324534839621090167050538805196124711247247992169338"), real(a), tol); BOOST_CHECK_CLOSE_FRACTION(real_type("-1.3826999557878897572499699021550296885662132089951379549068064961882821777067532977546360861176011175070188118"), imag(a), tol * 3); + a = pow(c, r + 0); + BOOST_CHECK_CLOSE_FRACTION(real_type(-46), real(a), tol); + BOOST_CHECK_CLOSE_FRACTION(real_type(9), imag(a), tol); + a = pow(r + 0, c); + BOOST_CHECK_CLOSE_FRACTION(real_type("-8.8931513442797186948734782808862447235385767991868219480917324534839621090167050538805196124711247247992169338"), real(a), tol); + BOOST_CHECK_CLOSE_FRACTION(real_type("-1.3826999557878897572499699021550296885662132089951379549068064961882821777067532977546360861176011175070188118"), imag(a), tol * 3); // Powers where one arg is an float. a = pow(c, 3.0);