Boost Users :
Subject: Re: [Boost-users] [numeric conversation] behavior on std::numeric_limits<double>::max() + eps with numeric_cast
From: Olaf Peter (ope-devel_at_[hidden])
Date: 2014-06-16 09:27:58
Am 16.06.2014 14:26, schrieb Brandon Kohn:
> On 6/15/2014 14:15 PM, Olaf Peter wrote:
>> Is there a way to override the default implementation for e.g. double?
>> The attached example fails to compile due to
>> redefinition of 'struct boost::numeric::numeric_cast_traits<double,
> If you define BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS then
> you can define the conversions for fundamental types. Even so,
> converting from double to double won't affect the value. There is a
> layer that checks for this an implements a trivial conversion that does
> nothing but return a const T&.
so, I can't use it like boost.math.round
(<boost/math/special_functions/round.hpp>) with polycies or doubles,
> On 6/15/2014 14:56 PM, Olaf Peter wrote:
>> Probably I did though to complicated before; but even using
>> make_converter_from doesn't compile :( Is the way correct and only my
>> typedef wrong?
>> BTW; why isn't there a RoundMath<> here, RoundEven<> policy does exist.
> What type of round does RoundMath do?
if(x < 0) floor(x-0.5) else ceil(x+0.5)
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