Am 16.06.2014 16:24, schrieb Brandon Kohn:
so, I can't use it like boost.math.round (
) with polycies or doubles, isn't it? I don't think it (numeric_cast) should be used to round doubles. For On 6/16/2014 09:27 AM, Olaf Peter wrote: that I would just call your rounder directly.
I wouldn't recommend this, but if you really wanted to use numeric_cast due to other reasons, you could try specializing it for the double to double case:
namespace boost { template <> double numeric_cast
(double value) { return boost::math::round(value); } }
My idea was to write a mathematical value class which can operate on integers and floats using different rounding algorithms (hence numeric_cast<int>(double from_sqrt) etc. ) and switch statically this type to see later which better fits my needs. Initialized are this values from boost.units where doubles are preferred as underlying type. Probably I have to specialize this class for integers and floats. Thanks, Olaf