They have different behaviours.
a//b rounds down, so 5//-2 == -3.
int(a/b) rounds towards zero, so int(5/-2) == -2
Edit to add: I just realized something important! a/b always produces a float. If a is too large for the quotient to be represented by a float (i.e, the result is greater than about 10^308), then a/b will fail with an OverflowError. This does not happen with a//b. Observe:
>>> int(10**1000/3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: integer division result too large for a float
>>> 10**1000//3
333333333333333333333333333333333333333333333333333...
Additionally, the floating point number resulting from the division will have rounding errors. Beyond about 2^53, 64-bit floating point numbers cannot accurately represent all integers, so you will get incorrect results:
>>> int(10**22/3)
3333333333333333508096
>>> 10**22//3
3333333333333333333333
Answer from SimonL on Stack OverflowPython.org
discuss.python.org › python help
Integer division - Python Help - Discussions on Python.org
January 25, 2023 - What is the result of this code: print(6 // 0.4) I thought the answer is 15.0 but I am getting 14.0. Any explanation for this answer I will appreciate.
GeeksforGeeks
geeksforgeeks.org › python › division-operators-in-python
Division Operators in Python - GeeksforGeeks
In Python, division operators allow you to divide two numbers and return the quotient. But unlike some other languages (like C++ or Java), Python provides two different division operators, each behaving slightly differently. Let’s explore them step by step. The quotient returned by this operator is always a float number, no matter if two numbers are integers...
Published September 17, 2025
Why Python's Integer Division Floors
I point I found rather funny... In mathematical number theory, mathematicians always prefer the latter choice (floor). isn't right (it even says so in the linked Wikipedia article). Number Theorists tend use the method where a mod b gives the least nonnegative representative. More on reddit.com
I’m trying to learn code and I’m not very good and I can’t figure out where I’m going wrong
/ is for dividing. If you want to find the remainder you need to use the modulo operator aka %. So 1398/11 == 127 and 1398%11 == 1 More on reddit.com
Is in your programming language `3/2=1` or `3/2=1.5`?
Integer result, but I do the more elegant Euclidean division, not just straight C truncated division. It has some nice mathematical properties that make it more consistent (e.g. when dealing with negative numbers), and allows for optimizations with bitwise operations. There's a neat little straight-to-the-point paper that outlines this and a few common approaches with some of the edge cases you might not necessarily think about here: Division and Modulus for Computer Scientists (Includes C source for Euclidean and Floored division, along with proof of correctness). (The full in-depth paper referenced by the above can be found here: Boute, 1992 ) More on reddit.com
You can do integer division in JavaScript
It took me longer than I'd like to understand. heavy sigh More on reddit.com
Videos
04:04
math basics - integer division (Python) - YouTube
06:20
Python Tutorial #5: Python Division: /, //, and % 🐍 - YouTube
03:17
Python Integer division and Remainders - YouTube
05:20
Python Programming: Exploring Integer Division and Operators - YouTube
Python Integers vs Floats - Visually Explained
05:15
Lec 189 Semantics of integer division - YouTube
LearnDataSci
learndatasci.com › solutions › python-double-slash-operator-floor-division
Python Double Slash (//) Operator: Floor Division – LearnDataSci
In Python, we can perform floor division (also sometimes known as integer division) using the // operator.
Hyperskill
hyperskill.org › university › python › integer-division-operator-in-python
Integer Division Operator in Python
December 25, 2025 - In Python, integer division, also referred to as floor division, involves discarding the remainder and returning the whole number part of the quotient. To perform division, in Python, you use two slashes (//). For instance, if you wish to divide two numbers and get the part of the outcome, ...
Reddit
reddit.com › r/programminglanguages › why python's integer division floors
r/ProgrammingLanguages on Reddit: Why Python's Integer Division Floors
February 16, 2024 - BTW, the >> operator of a signed integer by an integer n is equivalent to flooring division by 2**n . That is because the shifted-out bits are just discarded, without doing any rounding.
Medium
medium.com › @ryan_forrester_ › python-division-how-to-guide-903424ecc362
Python Division: How To Guide
October 24, 2024 - Notice that float division always ... result in whole numbers. Floor division, on the other hand, rounds down to the nearest integer. Float division can sometimes produce unexpected results due to how computers handle decimal numbers: print(0.1 + 0.2) # Output: 0.30000000000000004 print(2.5 / 0.5) # Output: 5.0 print(0.3 / 0.1) # Output: 2.9999999999999996 · This isn’t a Python bug — it’s ...
Hacker News
news.ycombinator.com › item
From slide 32: > (In Python 3 // is integer division) I find it clearer to descr... | Hacker News
April 18, 2017 - I find it clearer to describe this behavior as "floor" division. You might think "integer division" would have the same results as python 3's `int(a / b)` when `a` and `b` are ints, but, no, this is not the case. I never could quite understand why all the hub-bub about "integer division" and ...
W3Schools
w3schools.com › python › python_operators_arithmetic.asp
Python Arithmetic Operators
Python has two division operators: / - Division (returns a float) // - Floor division (returns an integer) Division always returns a float: x = 12 y = 5 print(x / y) Try it Yourself » · Floor division always returns an integer.
Blogger
python-history.blogspot.com › 2010 › 08 › why-pythons-integer-division-floors.html
The History of Python: Why Python's Integer Division Floors
A series of articles on the history of the Python programming language and its community. I was asked (again) today to explain why integer division in Python returns the floor of the result instead of truncating towards zero like C.
PrepBytes
prepbytes.com › home › python › python division operator
Python Division Operator
March 10, 2023 - With the division operator, programmers can perform various calculations that are required in everyday programming tasks. The Python division operator is a fundamental arithmetic operator used to divide two numbers and obtain their quotient. It is represented by the forward-slash symbol "/". Python division operators are of two types: integer division and float division.