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 12:50:22
> Do you mean the loss of precision when doing "x/order" and then
> "<result>*order" ? Anyway, I am not really convinced myself whether this
> round_to() is a good candidate for adding to boost ;-) I just wasn't sure
> you were asking for a ticket with that as well.
> However, my aside question remains, can that be implemented better?
Not sure to be honest.
>> Good question, I believe that can be the case if *r has not been
>> for example if r == boost::integer_traits<R>::**const_max + 0.1.
> What I meant above, and should have written, is that "T r = round(x)",
> x is the input value of a floating-point type T. With this assumption, do
> the conditions still hold, or can there be some roundidg error messing
Also not sure, it may certainly be true that:
int i = boost::integer_traits<R>::const_min;
float f = i;
assert(f < i); // succeeds!!
assert(i == f); // fails
Not sure what happens when you convert back though,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk