Comment 37 for bug 882036

Revision history for this message
Raphaƫl Valyi - http://www.akretion.com (rvalyi) wrote :

Dear OpenERP experts,

I don't yet what would be wrong with the algorithm we tried to propose here.
But I could see that the topic of rounding floats to the shortest decimal fraction is actually a known topic of numerical calculus.
I've found some sources claiming the best algorithm would be the Dybvig's one:
http://citeseer.ist.psu.edu/viewdoc/download;jsessionid=0CF999B48641E6A3CCDCCCA2D895827B?doi=10.1.1.52.2247&rep=rep1&type=pdf

Also, I've seen that Python 2.7 or 3.1 are doing such rounding to shortest decimal fraction. I don't know what they are using, but may be it's reusable somewhat.

I've also found this http://research.swtch.com/2011/07/floating-point-to-decimal-conversion-is.html
and this in response: http://smalltalk.gnu.org/blog/bonzinip/floating-point-decimal-conversion-not-so-easy

Holly shit!