
<big snip>> This should need a explicit conversion with my approach, as we reduce the range and/or the resolution.
f1 = fixed<15,16>(1.2345); f2 = fixed<15,16>(f1 - 2); f2 = fixed<15,16>(f1 / f2);
Would this syntax be convenient? Or, do we need something intermediary as f1 = convert(1.2345); f2 = convert(f1 - 2); f2 = convert(f1 / f2);
The template function convert will return a wrapper of its parameter that is accepted as an implicit conversion.
<snip>
Best, Vicente
As always, good luck with a project of such importance and complexity. I believe that boost mandates implicit conversion to built-in types *without* a conversion-wrapper. I think that this should work: fixed_point<15, -16> result3 = 3.141592654 * (radius * radius); // Should work! And if you ever get into stuff like this: fixed_point<8, -1024> one_third<1, 3>(); ... Then you may want to consider interaction with boost.math or a potential boost.multiprecision. Best regards, Chris.