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
Is there a way of converting between datatypes with different overflow tags.
What are you trying to do?
One may need to change the overflow type within an algorithm.
TEST(math, convert_overflow_type)
{
auto a = cnl::static_number<16,-15, cnl::neg_inf_rounding_tag, cnl::native_overflow_tag, int16_t>{0.5};
auto b = cnl::static_number<16,-15, cnl::neg_inf_rounding_tag, cnl::native_overflow_tag, int16_t>{0.5};
auto c = a + b;
cnl::static_number<16,-15, cnl::neg_inf_rounding_tag, cnl::saturated_overflow_tag, int16_t> d = c;
std::cout << "d = " << d << std::endl;
}
I took a look at this yesterday. There is a set_rounding_t alias which does a near-identical thing for rounding_integer. But a quick fix to copy/paste this as set_overflow_t isn't as quite simple as it sounds and merely highlights the fact that there is a more general-purpose solution fighting to get out.
I think that adapting set_tag_t so that it works recursively, is probably the way to go. This will replace set_rounding_t and be used thus:
What is your question?
Is there a way of converting between datatypes with different overflow tags.
What are you trying to do?
One may need to change the overflow type within an algorithm.
Going through rep works but is quite cumbersome:
The text was updated successfully, but these errors were encountered: