The problem is that the factorials you are working with are way too
big to represent as floats exactly.
You have these two values:
>>> a = math.factorial(420-1) # 419*418*417*...*3*2*1
>>> b = math.factorial(420-8) # 412*411*410*...*3*2*1
These are huge numbers.
a has over 900 digits:
The largest whole number floats can store exactly is
which you start to get rounding errors:
>>> x = 2**53
>>> float(x) == x
>>> float(x) + 1 == x + 1
That number has only 18 decimal digits, about 900 short of the
requirement to store the factorials above. So as soon as you convert to
floats using the
/ operator, you lose accuracy:
>>> a/b # Division done using floating point maths
>>> a//b # True value, done exactly with integer maths
So the true result, which should end with 70720, gets rounded off to
ending with 70800 instead.
See the tutorial and the FAQs: