You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone, as the title says, i was trying to use cpp_int defined in boost::multiprecision as base type. But when i declare a fixed point using cpp_int like this: using position = fpm::fixed<boost_int16_t, int128_t, 16>; i get some errors:
fpm/fixed.hpp:21:47: error: static assertion failed: BaseType must be an integral type
21 | static_assert(std::is_integral::value, "BaseType must be an integral type");
fpm/fixed.hpp:47:56: error: no match for 'operator*' (operand types are 'double' and 'const boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<15, 15, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >')
47 | : m_value(static_cast(std::round(val * FRACTION_MULT)))
And some other. Do you have any suggestions?
The text was updated successfully, but these errors were encountered:
Currently, fpm::fixed requires its templated types to be integrals (via a std::is_integral check). Indeed it would be nice to support integral-like types like boost::multiprecision::cpp_int. I'm not sure yet how to verify at compile time that a type is integral-like, but I'll see what can be done. I'll turn this into a feature request.
MikeLankamp
changed the title
How to use boost::multiprecision cpp_int as base_type
Support boost::multiprecision::cpp_int as BaseType
Jun 29, 2021
Hi everyone, as the title says, i was trying to use cpp_int defined in boost::multiprecision as base type. But when i declare a fixed point using cpp_int like this: using position = fpm::fixed<boost_int16_t, int128_t, 16>; i get some errors:
fpm/fixed.hpp:21:47: error: static assertion failed: BaseType must be an integral type
21 | static_assert(std::is_integral::value, "BaseType must be an integral type");
fpm/fixed.hpp:47:56: error: no match for 'operator*' (operand types are 'double' and 'const boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<15, 15, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void> >')
47 | : m_value(static_cast(std::round(val * FRACTION_MULT)))
And some other. Do you have any suggestions?
The text was updated successfully, but these errors were encountered: