openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00414
Re: float errors propagating to 10^-2 in OpenERP v5...
Raphaël Valyi wrote:
Well, of course, I made a small mistake in my mail, I meant 14 000
moves is ~10^5, meaning we expect a 10^-17* 10^5=10^12 error at first
when summing moves while we already get a 10^-9 error. The question
why is still open.
And off course, how that 10^⁻9 propagates to 10^-2 in the chart of
accounts is still open and should be fixed...
I would say 10^⁻9 is the error to be expected with 14000 moves, not 10^12.
An easy example: summing 14000 times the same float vs using multiplying
it by 14000 (mathematically they should be the same).
$ cat tmp.py
diffs=[]
for j in range(0, 10000):
s=0.0
k=j/14000.0
for i in range(0, 14000):
s+=k
diffs.append(abs(k*14000.0-s))
print "max: ", max(diffs)
print "min: ", min(diffs)
print "avg: ", sum(diffs)/len(diffs)
$ python tmp.py
max: 3.71619535144e-09
min: 0.0
*avg: 8.2300255102e-10*
As you can see the average rounding error for 10000 floats is almost 10^-9 !
Anyway, I don't understand how Sharoon is getting a 10^-2 rounding error
on __calculate :(
By the way, Decimal is a lot slower of what I thought. The same test as
above, but done with Decimal gives a maximum 0.0 rounding error but
takes about 100 times more time than using floats (53.28 vs 0.43 seconds
for 100 'j' loops), wow, that's bad.
--
Borja López Soilán
borjals@xxxxxxxxx
Pexego Sistemas Informáticos S.L.
Avenida de Magoi 66 - 27002 Lugo (España)
Tel./Fax 982801517
http://www.pexego.es
AVISO LEGAL - CLÁUSULA DE PRIVACIDAD
Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si no es usted el destinatario indicado, queda informado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.
Follow ups
References