<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/odoo/addons/base/tests/test_float.py, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FIX] base: tools: float_split_str: avoid traceback when rounding to 0 places and add some test cases</title>
<updated>2021-03-16T13:21:42+00:00</updated>
<author>
<name>oco-odoo</name>
<email>oco@odoo.com</email>
</author>
<published>2021-03-11T11:12:02+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=e1df7aea0f1209398ca318678ba6742d7d986cb0'/>
<id>e1df7aea0f1209398ca318678ba6742d7d986cb0</id>
<content type='text'>
closes odoo/odoo#67949

X-original-commit: 42d409f180381316c97abd0c0ef5a062656e6122
Signed-off-by: Olivier Dony (odo) &lt;odo@openerp.com&gt;
Signed-off-by: oco-odoo &lt;oco-odoo@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
closes odoo/odoo#67949

X-original-commit: 42d409f180381316c97abd0c0ef5a062656e6122
Signed-off-by: Olivier Dony (odo) &lt;odo@openerp.com&gt;
Signed-off-by: oco-odoo &lt;oco-odoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch saas-12.4 up to f26de445e55</title>
<updated>2019-08-21T08:10:11+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2019-08-21T08:10:11+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=3faea8fbf810224ad4e03cfa1dc36f186800c501'/>
<id>3faea8fbf810224ad4e03cfa1dc36f186800c501</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch 12.0 up to 32039b2ab44</title>
<updated>2019-08-19T16:57:08+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2019-08-19T16:57:08+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=168e54d48850418a6a83f71427e74ed27f66595b'/>
<id>168e54d48850418a6a83f71427e74ed27f66595b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] tools: epsilon magnitude</title>
<updated>2019-08-07T08:25:53+00:00</updated>
<author>
<name>Nicolas Martinelli</name>
<email>nim@odoo.com</email>
</author>
<published>2019-08-07T07:28:57+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=fde3b696562a12dc3ec99fcb85004a6a40e040f0'/>
<id>fde3b696562a12dc3ec99fcb85004a6a40e040f0</id>
<content type='text'>
The following rounding is incorrect:
```
&gt;&gt;&gt; float_round(6.6 * 0.175, precision_digits=2)
1.15
```

Indeed, 6.6 * 0.175 = 1.155 ≈ 1.16.

In this specific case, the `epsilon` computed is not sufficient. A
precision of 53 gives:
normalized_value = 115.49999999999997
epsilon = 1.2823075934420547e-14
=&gt; new normalized_value = 115.49999999999999

Bad luck, this is just not enough to tip the value in the right
direction.

However, a precision of 52 is sufficient:
normalized_value = 115.49999999999997
epsilon = 2.5646151868841094e-14
=&gt; new normalized_value = 115.5

The value of 53 was chosen from the `binary64` number format precision.
In case of Python, the corresponding machine epsilon is 2^-52 [1].
Therefore, using 52 instead of 53 does make sense.

It is worth noting that the value of the machine epsilon
2^-52 = 2.2204460492503131e-16, which is still 2 orders of magnitude
below our dynamic estimation.

[1] https://en.wikipedia.org/wiki/Machine_epsilon
[2] `numpy.finfo(float).eps = 2.2204460492503131e-16`

opw-2047368

closes odoo/odoo#35521

Signed-off-by: Nicolas Martinelli (nim) &lt;nim@odoo.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following rounding is incorrect:
```
&gt;&gt;&gt; float_round(6.6 * 0.175, precision_digits=2)
1.15
```

Indeed, 6.6 * 0.175 = 1.155 ≈ 1.16.

In this specific case, the `epsilon` computed is not sufficient. A
precision of 53 gives:
normalized_value = 115.49999999999997
epsilon = 1.2823075934420547e-14
=&gt; new normalized_value = 115.49999999999999

Bad luck, this is just not enough to tip the value in the right
direction.

However, a precision of 52 is sufficient:
normalized_value = 115.49999999999997
epsilon = 2.5646151868841094e-14
=&gt; new normalized_value = 115.5

The value of 53 was chosen from the `binary64` number format precision.
In case of Python, the corresponding machine epsilon is 2^-52 [1].
Therefore, using 52 instead of 53 does make sense.

It is worth noting that the value of the machine epsilon
2^-52 = 2.2204460492503131e-16, which is still 2 orders of magnitude
below our dynamic estimation.

[1] https://en.wikipedia.org/wiki/Machine_epsilon
[2] `numpy.finfo(float).eps = 2.2204460492503131e-16`

opw-2047368

closes odoo/odoo#35521

Signed-off-by: Nicolas Martinelli (nim) &lt;nim@odoo.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] base/web: store more precision digits for rate field</title>
<updated>2019-08-06T05:28:35+00:00</updated>
<author>
<name>Mitali Patel</name>
<email>mpa@odoo.com</email>
</author>
<published>2019-06-19T10:21:23+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=857c4851754dcddf9e6dc7b39585914beaf89c88'/>
<id>857c4851754dcddf9e6dc7b39585914beaf89c88</id>
<content type='text'>
Currently, only 6 digits after decimal point is stored in database and for some currencies
it may require to have more digits after decimal precision to correctly convert rates,
like MXN -&gt; USD currency. So, we allow maximum digits to be stored in database.

On the view side, wherever rate is editable(form or tree view), we show 12 digits
after decimal point and on list view, we truncate limit it to 6 digits.

Also, a bug is fixed for web where 'digits' attribute for float field on list view isn't considered.

Also, we have to remove a test case statement which only checks for 6 digits for a float number.

task: 2024668
closes: #34279

Signed-off-by: Josse Colpaert &lt;jco@openerp.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, only 6 digits after decimal point is stored in database and for some currencies
it may require to have more digits after decimal precision to correctly convert rates,
like MXN -&gt; USD currency. So, we allow maximum digits to be stored in database.

On the view side, wherever rate is editable(form or tree view), we show 12 digits
after decimal point and on list view, we truncate limit it to 6 digits.

Also, a bug is fixed for web where 'digits' attribute for float field on list view isn't considered.

Also, we have to remove a test case statement which only checks for 6 digits for a float number.

task: 2024668
closes: #34279

Signed-off-by: Josse Colpaert &lt;jco@openerp.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] tools: float_utils, precision rounding must be positive</title>
<updated>2019-02-13T07:05:13+00:00</updated>
<author>
<name>Jorge Pinna Puissant</name>
<email>jpp@odoo.com</email>
</author>
<published>2019-01-30T09:12:18+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=e270e9e0cc6574d2c6bdd29983d3b66d12d2ced7'/>
<id>e270e9e0cc6574d2c6bdd29983d3b66d12d2ced7</id>
<content type='text'>
Adding a new rule to verify that precision_rounding is positive.

Before this commit:
when a precision_round was 0 or smaller than 0 the float_utils
functions gave as results:
* float_is_zero(0.0, precision_rounding=0.0) -&gt; False
* float_round(1.25, precision_rounding=0.0) -&gt; 0.0
* float_compare(1.0, 1.0, precision_rounding=0.0) -&gt; 1

These results where at least not correct at worst not logic.

Now, the function raises an error when the precision_rounding
is not positive</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adding a new rule to verify that precision_rounding is positive.

Before this commit:
when a precision_round was 0 or smaller than 0 the float_utils
functions gave as results:
* float_is_zero(0.0, precision_rounding=0.0) -&gt; False
* float_round(1.25, precision_rounding=0.0) -&gt; 0.0
* float_compare(1.0, 1.0, precision_rounding=0.0) -&gt; 1

These results where at least not correct at worst not logic.

Now, the function raises an error when the precision_rounding
is not positive</pre>
</div>
</content>
</entry>
<entry>
<title>[REF] *: replace deprecated pycompat helpers for builtins</title>
<updated>2018-11-29T09:28:17+00:00</updated>
<author>
<name>Adrian Torres</name>
<email>adt@odoo.com</email>
</author>
<published>2018-11-08T15:27:30+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=52f5528cfb6d1152ee226e268247dc685a8ba329'/>
<id>52f5528cfb6d1152ee226e268247dc685a8ba329</id>
<content type='text'>
This commit replaces calls to pycompat helpers that were intended for
python 2 &lt;-&gt; python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.

This includes:
    * calls to imap/izip/ifilter replaced by map/zip/filter
    * uses of text_type replaced by str
    * uses of unichr replaced by chr
    * calls to implements_to_string, implements_iterator removed
    * string_types and integer_types replaced by str, int respectively
    * calls to to_native replaced by calls to to_text

This is done in preparation to the removal of these deprecated helpers
in the following commit.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit replaces calls to pycompat helpers that were intended for
python 2 &lt;-&gt; python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.

This includes:
    * calls to imap/izip/ifilter replaced by map/zip/filter
    * uses of text_type replaced by str
    * uses of unichr replaced by chr
    * calls to implements_to_string, implements_iterator removed
    * string_types and integer_types replaced by str, int respectively
    * calls to to_native replaced by calls to to_text

This is done in preparation to the removal of these deprecated helpers
in the following commit.</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch 11.0 up to ad825b673b5</title>
<updated>2018-04-16T16:34:56+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2018-04-16T16:34:56+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=5f2d080cf85d54bc52895f9dbc4075b10989d324'/>
<id>5f2d080cf85d54bc52895f9dbc4075b10989d324</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] base: amount_to_text possible difference</title>
<updated>2018-04-11T06:57:20+00:00</updated>
<author>
<name>Nicolas Lempereur</name>
<email>nle@odoo.com</email>
</author>
<published>2018-04-10T10:39:58+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b79d8b99ff39d1889df89debed012fc7cc54598e'/>
<id>b79d8b99ff39d1889df89debed012fc7cc54598e</id>
<content type='text'>
In 79038055 amount_to_text was refactored and improved, but there is a
drawback.

ie. if we have .29 cents with two decimals, `Twenty-Eight` was displayed
because `int(0.29 * 100) == 28` due to floating-point representation.

This commit keeps the improvements and fix this issue by using string
formatting of float as was done before.

opw-1829924
closes #24161
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In 79038055 amount_to_text was refactored and improved, but there is a
drawback.

ie. if we have .29 cents with two decimals, `Twenty-Eight` was displayed
because `int(0.29 * 100) == 28` due to floating-point representation.

This commit keeps the improvements and fix this issue by using string
formatting of float as was done before.

opw-1829924
closes #24161
</pre>
</div>
</content>
</entry>
<entry>
<title>[MERGE] forward port branch 11.0 up to f5e7b866860</title>
<updated>2018-02-01T17:15:21+00:00</updated>
<author>
<name>Christophe Simonis</name>
<email>chs@odoo.com</email>
</author>
<published>2018-02-01T17:15:21+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=7e469eb77aae1f7e05a3ce0f6575b5149fed3ca1'/>
<id>7e469eb77aae1f7e05a3ce0f6575b5149fed3ca1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
