# [issue16460] Strange results for floor division ("//") with non-integer divisors

```Martin v. Löwis added the comment:

Am 12.11.12 14:53, schrieb Tom Pohl:
> What do I expect from FD (x//y):
> 1. Perform a division (I don't care about the details here).
> 2. Return an integer value q (even if it's stored in a float).
> 3. The absolute difference between the mathematical division q'=x/y and the
> returned result q is less than 1, since it's just a floor operation, right?
>
> 1//0.1 = 9.0 violates my personal last expectation and I guess I'm not the
> only one.```
```
However, it matches *precisely* your description of what you expect:

1. 1 divided-by 0.1 gives
9.99999999999999944488848768742176060306327615036178207623262235371852234374499248...

Please understand that the correct result of 1 divided-by 0.1 is *not*
10, because 0.1 is *not* 1/10.

2. returned is then the integer 9

3. the difference is
.99999999999999944488848768742176060306327615036178207623262235371852234374499248...
which is indeed smaller than 1.

P.S. In case you want to get a more exact result of 1 divided-by 0.1,
get the digits from

int(1/fractions.Fraction(0.1)*10**180)

----------

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

```