mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-01-30 20:12:17 +00:00
Fix overloads of binary functions to allow mixed types in expression templates.
For example complex+real expression. Mixed expression+expression is not currently supported (it's complicated!). Fixes: https://github.com/boostorg/multiprecision/issues/69.
This commit is contained in:
@@ -3153,7 +3153,7 @@ func(const number<Backend, et_on>& arg, const number<Backend, et_on>& a)\
|
||||
}\
|
||||
template <class Backend, class tag, class A1, class A2, class A3, class A4> \
|
||||
inline typename enable_if_c<\
|
||||
(number_category<Backend>::value == category) && (number_category<detail::expression<tag, A1, A2, A3, A4> >::value == category),\
|
||||
(number_category<Backend>::value == category) && (boost::is_convertible<typename detail::expression<tag, A1, A2, A3, A4>::result_type, number<Backend, et_on> >::value),\
|
||||
detail::expression<\
|
||||
detail::function\
|
||||
, detail::BOOST_JOIN(category, BOOST_JOIN(func, _funct))<Backend> \
|
||||
@@ -3175,7 +3175,7 @@ func(const number<Backend, et_on>& arg, const detail::expression<tag, A1, A2, A3
|
||||
}\
|
||||
template <class tag, class A1, class A2, class A3, class A4, class Backend> \
|
||||
inline typename enable_if_c<\
|
||||
(number_category<Backend>::value == category) && (number_category<detail::expression<tag, A1, A2, A3, A4> >::value == category),\
|
||||
(number_category<Backend>::value == category) && (boost::is_convertible<typename detail::expression<tag, A1, A2, A3, A4>::result_type, number<Backend, et_on> >::value),\
|
||||
detail::expression<\
|
||||
detail::function\
|
||||
, detail::BOOST_JOIN(category, BOOST_JOIN(func, _funct))<Backend> \
|
||||
|
||||
@@ -2266,6 +2266,12 @@ typename boost::enable_if_c<boost::multiprecision::number_category<Real>::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);
|
||||
|
||||
Reference in New Issue
Block a user