|
Boost : |
Subject: Re: [boost] [math] potentian bug: iround throws, given double( numeric_limits<int>::min() )
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-10-24 07:15:51
>> OK, can you file a feature request at svn.boost.org so I don't forget
>> this?
>>
>> Thanks, John.
>
>
> Done, Ticket #6047 - about round_cast().
>
> Would you like a ticket for the following round_to as well?
> template < class T >
> T round_to( const T& x, const T& order )
> {
> return round( x / order ) * order;
> }
I'm not sure about that one, if "order" is anything other than a power of
T's radix then the result will be rounded - ie the result will not
necessarily actually be a true multiple of "order"?
> I'm still not sure if: can r > boost::integer_traits<R>::const_max be
> true,
> and still static_cast<R>(r) == boost::integer_traits<R>::const_max?
Good question, I believe that can be the case if *r has not been rounded*,
for example if r == boost::integer_traits<R>::const_max + 0.1.
HTH, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk