
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 if 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 rounded*, 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)", where 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 with them?
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, John.