[Erp5-dev] Cannot pack SPL - is it float rounding problem? Is it _a problem_?

Romain Courteaud romain at nexedi.com
Thu May 24 18:52:38 CEST 2007


* ??ukasz K. Nowak [2007-05-24 10:55:32 +0200]:

> Hello,

Hello Lukasz,

> It is not possible to pack Sale Packing List, even giving it proper
> values.
> 
> Eg. if I'm trying to sell 60.0 of resources it is going well, but with
> 59.333333333333336 - I'm not able to pack SPL, even when Container has
> proper exact value.
> 
> Is it a bug? Is there any test for it? I think it is related to
> http://www.erp5.org/Discussion/FloatRounding - is there any progress
> with this problem?

Clearly, yes, it's a bug.

Currently, I don't know how to fix your issue.

Documentation about float number standard (IEEE) is required, in order
to find a good solution.

What are the specification of addition and substraction for float ?
If a=b-c, is a+c==b always true ?

If some operations are specified to always work, can we fix ERP5 to
follow those operations.
What are the invariants in float operations for IEEE and for python.

Does REAL number in mysql (used by the movement table) have the same
precision as python float ?

> Unit test attached.

Thanks for your unit test, it's really good to quickly check.
It may be good to add it in the standard ERP5 tests, but as you didn't 
specify the license of your test, I can not do anything with it.
Can you please add an licence header to your code, in order to let use
now if we can add it.

Romain



More information about the Erp5-dev mailing list