Tim Peters <t...@python.org> added the comment:

This report appears to be the same:

https://bugs.python.org/issue27463

One other thing to note:  the Python docs are sometimes unclear about whether 
expressions are intended to be interpreted as Python code or as mathematical 
expressions.  In:

"""
floor division will be implemented in all the Python numeric types, and will 
have the semantics of:

a // b == floor(a/b)
"""

note that it did _not_ say `math.floor(a/b)`.  `floor(a/b)` here is intended to 
be read as a mathematical (infinitely precise) specification.  As can be 
inferred from the output Serhiy posted, after the Python

a = 0.9
b = 0.1

the infinitely precise value of `a/b` is a tiny bit less than 9, so the 
infinitely precise value of `floor(a/b)` is exactly 8.  Which is what the 
Python `a // b` returns.

Personally, I wish Python 3 had changed the meaning of `//` (and `divmod()` and 
`%` - the three are deeply related) for floats, but too late for that now :-)

----------

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

Reply via email to