<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/odoo/tools/float_utils.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>[FIX] *: typos and english incoherences</title>
<updated>2020-09-07T15:10:11+00:00</updated>
<author>
<name>Victor Feyens</name>
<email>vfe@odoo.com</email>
</author>
<published>2020-09-07T13:50:37+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=4214f05d454bca2b60fda3a288d529c098e84f77'/>
<id>4214f05d454bca2b60fda3a288d529c098e84f77</id>
<content type='text'>
Mainly transifex issues but also some errors found through 'grep' checks.

Fix typos and obscure english strings in xml contents, fields strings/helps, some docstrings, ...
ensuring correct translations base (and fallback when translations isn't available).

closes odoo/odoo#57206

Related: odoo/enterprise#13032
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mainly transifex issues but also some errors found through 'grep' checks.

Fix typos and obscure english strings in xml contents, fields strings/helps, some docstrings, ...
ensuring correct translations base (and fallback when translations isn't available).

closes odoo/odoo#57206

Related: odoo/enterprise#13032
Signed-off-by: Martin Trigaux (mat) &lt;mat@odoo.com&gt;
</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] 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>[REM] pycompat: remove python 2 shims and helpers</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:03:33+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=758382b3a73da024d6e1dc04a474d2868223767a'/>
<id>758382b3a73da024d6e1dc04a474d2868223767a</id>
<content type='text'>
Odoo no longer supports python 2, thus some of these helpers can and
have been replaced by python 3 built-ins, therefore there is no need for
them to stay defined.

The removed helpers are:
    * izip, imap and ifilter
    * unichr, text_type
    * implements_to_string, implements_iterator
    * string_types, integer_types
    * to_native

The python 2 shims have also been removed, and only the python 3 helpers
have been kept, because they can still be usable (i.e. accepting
both bytes and str for functions that can only accept one of the two)

[REM] pyjsparser: remove PY3 shims

They're no longer necessary as Odoo doesn't officially support python 2
anymore.

closes odoo/odoo#28519</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Odoo no longer supports python 2, thus some of these helpers can and
have been replaced by python 3 built-ins, therefore there is no need for
them to stay defined.

The removed helpers are:
    * izip, imap and ifilter
    * unichr, text_type
    * implements_to_string, implements_iterator
    * string_types, integer_types
    * to_native

The python 2 shims have also been removed, and only the python 3 helpers
have been kept, because they can still be usable (i.e. accepting
both bytes and str for functions that can only accept one of the two)

[REM] pyjsparser: remove PY3 shims

They're no longer necessary as Odoo doesn't officially support python 2
anymore.

closes odoo/odoo#28519</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 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>
<entry>
<title>[FIX] tools: float_round DOWN</title>
<updated>2018-01-29T10:06:33+00:00</updated>
<author>
<name>Nicolas Martinelli</name>
<email>nim@odoo.com</email>
</author>
<published>2018-01-25T12:06:27+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=8ed7570b1cc50c55867f75eafb20c1deb89dbf5c'/>
<id>8ed7570b1cc50c55867f75eafb20c1deb89dbf5c</id>
<content type='text'>
The result of the following:
```
float_round(2.5, precision_rounding=0.05, rounding_method='DOWN')
```
is 2.45. Instead, 2.5 is expected.

In case of the `DOWN` method, epsilon should be added, not subtracted.
In the meantime, we introduce a slight reorganization of the method to
make it clearer.

opw-805008
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The result of the following:
```
float_round(2.5, precision_rounding=0.05, rounding_method='DOWN')
```
is 2.45. Instead, 2.5 is expected.

In case of the `DOWN` method, epsilon should be added, not subtracted.
In the meantime, we introduce a slight reorganization of the method to
make it clearer.

opw-805008
</pre>
</div>
</content>
</entry>
<entry>
<title>[IMP] tools: basic spelling and grammar corrections</title>
<updated>2017-10-25T07:22:52+00:00</updated>
<author>
<name>Andrew Latham</name>
<email>lathama@gmail.com</email>
</author>
<published>2017-10-23T16:02:19+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=b67e18bcb53c7551c1c6a1056224960e06ae4fe2'/>
<id>b67e18bcb53c7551c1c6a1056224960e06ae4fe2</id>
<content type='text'>
Closes #20391
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Closes #20391
</pre>
</div>
</content>
</entry>
</feed>
