Q:

why // (division floor) produces result but math.floor() gives an OverflowError

I was solving a programming question, where I was required to find float division of a very large number (10^100,000) with another number (10^5).
However when I was importing floor from math module it gave me a run time error, but when I tried the same using // it showed me the result.
I want to know why such difference?
What is the difference between // and math.floor().
I am a beginner and cannot find related material.
using
using math.floor

>>> import math
>>> math.floor( pow(10,1000) / 1000 )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: integer division result too large for a float

using //
pow(10,1000) // 1000
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

A:

That's because pow(10,1000) / 1000 is floating-point division and pow(10,1000) // 1000 is integer division.
As you can see, in your case integer division result [is] too large for a float because pow(10,1000) / 1000 attempts to produce a float, but the result will be 10**997, which won't fit even in a 64-bit float. The double-precision floating-point format (a.k.a. "binary64") is fixed-width and allows you to store numbers up to 10**308. If you wanted to store this number anyway, you'd need to use the "binary80" format, which isn't present in Python out-of-the-box and possibly still won't be able to represent the result exactly.
Integer division in Python is different because the int type is bounded solely by your RAM. For example, Python can calculate the integer 10**10000 (which is your_huge_number ** 10!) in a blink of an eye.

