← Back to team overview

openerp-india team mailing list archive

[Bug 882036] Re: rounding error

 

> The round issue is a python bug (not a OpenERP bug) ?! Or not ?

It's neither and both, it's an inaccuracy issue with the way floating-
point numbers are stored[0], leading to a number of problems [1] [2]
when trying to perform precise manipulation (including rounding) of
floating-point numbers (floats and doubles). Lorenzo also nicely
outlined the issues in the message he linked.

The behavior is deterministic, but that does not make it any easier to
handle.

[0] http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
[1] http://docs.python.org/tutorial/floatingpoint.html
[2] http://www.lahey.com/float.htm

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/882036

Title:
  rounding error

Status in OpenERP Server:
  New

Bug description:
  Concerns 6.0 and trunk.
  If you define a precision of 0.01, the rounding of 0.125 must be 0.13 and not 0.12. The error is in the call of the format string "%.2f"%val which introduces a mathematical error. The round function must be called to apply the correct rounding before formatting the string. It should be:
  "%.2f"%round(val*100)/100
  Fix class digits_change of class float in the server. BUT fix also the gtk client AND web client as they all have that error (I let you find the right line)

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/882036/+subscriptions


References