Hello Cloves, I was about to provide a similar comment: your 2^-52 espilon seems to be to small (failed one -2.675) and Pieter's (.1 / pow(10, p+2)) epsilon was to large: fails on r2(1.00499, 2) I could test that 2^-51 would always work in the range I tested. And I agree with you 2^-50 is probably small enough to be very safe to use and large enough so it will always fix the rounding direction. It would be cool if somebody has the courage to try a math model of that to know what exactly the implications are (We had 17 digits of initial precision, each time we sum or multiply 2 floats we loose that precision, by doing that epsilon rounding trick, I guess we eat our precision even more; at the end of the story it would be good to have orders of magnitudes where we are safe with floats or not). I'm quite confident i can fit for most SMB's even if I'm not qualified enough to defend the choice for floats. Now if we should mimic HALF EVEN in decimal system, indeed, this is more tricky to implement. I'm however surprised it could be mandatory (do the cheap hand calculators one use have Half Even decimal rounding?). In Brazil we have been emitting lot of fiscal electronic invoices computed originally with OpenERP. Would the Fisc accept them (as they did) and then bother us because rounding is not half even? For the Brazilian "Sped fiscal" and "Sped Contavel" may be? Also in France, one of our customers had a fiscal control this year and they passed it despite this rounding behavior. I'm not sure if the Decimal class based rounding is better. It seems better of course but I'm not sure if it's worth the performance penalty, I'm really not qualified from that. I made a quick benchmark, so on my computer I have: rounding 2.65 to 2 digits with def roundf(f, p): return float(Decimal(str(f)).quantize(Decimal(str(pow(10,-p))))) would take 47.34 seconds where it takes 3.3 seconds with def r1(f, p=0): return round(f + cmp(f, 0) * pow(2, -51), p) So that's a fat 10x slower using Decimal rounding. If it can let you control the rounding policy you want, I would favor Decimal rounding. But again, I'm really not qualified here, so was just an opinion. Comments are welcome. On Wed, Nov 23, 2011 at 5:55 PM, Cloves Almeida