brython-dev / brython

Brython (Browser Python) is an implementation of Python 3 running in the browser
BSD 3-Clause "New" or "Revised" License
6.4k stars 511 forks source link

1.//.1 produces different results : 0.9 in Python and 1.0 in Brython #2506

Closed denis-migdal closed 1 month ago

denis-migdal commented 1 month ago

In Brython:

>>> 1.//.1
10.0

In Python:

>>> 1.//0.1
9.0

My guess is that Python doesn't do floor(1./.1) but uses a different formula.

denis-migdal commented 1 month ago

I believe Python may be doing something like:

// a//b
( a-(a%b) )/b