I'm not sure if this is a bug or if I'm just misunderstanding how integer division is supposed to work.
Consider the following code:
import math
a = 18000
b = 5500
c = (a-b)/9 # c = 1388.(8)
d = (a-b)/c
e = (a-b)//c
f = math.floor(d)
print(f"(a-b)/c={d}, (a-b)//c={e}, floor={f}") # outputs (a-b)/c=9.0, (a-b)//c=8.0, floor=9
Why is e
different from d
? As far as I understand, num1//num2
should be equal to math.floor(num1/num2)
.
Using Python 3.8.10 32bit on Windows 10 Pro.