New submission from Antoine Pitrou:

>>> (78*6e-8) / 6e-8
78.0
>>> (78*6e-8) // 6e-8
77.0

Note this doesn't make divmod() wrong:

>>> q, r = divmod(78*6e-8, 6e-8)
>>> q, r
(77.0, 5.999999999999965e-08)
>>> r < 6e-8
True
>>> q * 6e-8 + r == 78*6e-8
True

But, still, it is somewhat of an oddity to not return the real quotient when it 
is an exact integer.

Note this came from a Numpy issue where Numpy actually shows better behaviour:
https://github.com/numpy/numpy/issues/6127

----------
components: Interpreter Core
messages: 250786
nosy: mark.dickinson, pitrou, tim.peters
priority: normal
severity: normal
status: open
title: suboptimal floating-point floor division
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25129>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to