Boost logo

Boost Users :

Subject: [Boost-users] Cpp_int and cpp_dec_float conversion
From: Alessandro Tagliapietra (tagliapietra.alessandro_at_[hidden])
Date: 2013-04-22 12:18:42


Hello,

is there a way to convert from cpp_int to cpp_dec_float and viceversa?

Since I've to use the modulus between two cpp_dec_float which I know
they're integers but I need sqrt before and trying to run % with them gives:

/usr/local/include/boost/multiprecision/number.hpp: In member function
> ‘void boost::multiprecision::number<Backend,
> ExpressionTemplates>::do_assign(const Exp&, const
> boost::multiprecision::detail::modulus_immediates&) [with Exp =
> boost::multiprecision::detail::expression<boost::multiprecision::detail::modulus_immediates,
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>,
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>, void, void>, Backend =
> boost::multiprecision::backends::cpp_dec_float<100u, int, void>,
> boost::multiprecision::expression_template_option ExpressionTemplates =
> et_on]’:
> /usr/local/include/boost/multiprecision/number.hpp:680: instantiated
> from ‘void boost::multiprecision::number<Backend,
> ExpressionTemplates>::do_assign(const
> boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>&,
> const mpl_::true_&) [with tag =
> boost::multiprecision::detail::modulus_immediates, Arg1 =
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>, Arg2 =
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>, Arg3 = void, Arg4 = void, Backend =
> boost::multiprecision::backends::cpp_dec_float<100u, int, void>,
> boost::multiprecision::expression_template_option ExpressionTemplates =
> et_on]’
> /usr/local/include/boost/multiprecision/number.hpp:134: instantiated
> from ‘typename boost::enable_if<boost::is_convertible<typename
> boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3,
> Arg4>::result_type, boost::multiprecision::number<Backend,
> ExpressionTemplates> >, boost::multiprecision::number<Backend,
> ExpressionTemplates>&>::type boost::multiprecision::number<Backend,
> ExpressionTemplates>::operator=(const
> boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>&)
> [with tag = boost::multiprecision::detail::modulus_immediates, Arg1 =
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>, Arg2 =
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>, Arg3 = void, Arg4 = void, Backend =
> boost::multiprecision::backends::cpp_dec_float<100u, int, void>,
> boost::multiprecision::expression_template_option ExpressionTemplates =
> et_on]’
> /usr/local/include/boost/multiprecision/number.hpp:181: instantiated
> from ‘boost::multiprecision::number<Backend,
> ExpressionTemplates>::number(const
> boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>&,
> typename boost::enable_if_c<boost::is_convertible<typename
> boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3,
> Arg4>::result_type,boost::multiprecision::number<Backend,
> ExpressionTemplates> >::value, void>::type*) [with tag =
> boost::multiprecision::detail::modulus_immediates, Arg1 =
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>, Arg2 =
> boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100u,
> int, void>, et_on>, Arg3 = void, Arg4 = void, Backend =
> boost::multiprecision::backends::cpp_dec_float<100u, int, void>,
> boost::multiprecision::expression_template_option ExpressionTemplates =
> et_on]’
> test.cpp:20: instantiated from here
> /usr/local/include/boost/multiprecision/number.hpp:912: error: invalid
> application of ‘sizeof’ to incomplete type
> ‘boost::STATIC_ASSERTION_FAILURE<false>’

Thanks in advance

Best Regards



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net