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 Overflow
🌐
Python.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
Discussions

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
🌐 r/ProgrammingLanguages
11
13
February 16, 2024
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
🌐 r/CodingHelp
53
97
August 13, 2021
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
🌐 r/ProgrammingLanguages
138
42
February 2, 2023
You can do integer division in JavaScript
It took me longer than I'd like to understand. heavy sigh More on reddit.com
🌐 r/shittyprogramming
69
295
March 13, 2015
🌐
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, ...
🌐
OpenStax
openstax.org › books › introduction-python-programming › pages › 2-5-dividing-integers
2.5 Dividing integers - Introduction to Python Programming | OpenStax
March 13, 2024 - Hint: Calculate the total change, in cents, as an integer. Use the round() function to avoid floating-point errors. Your code must not use Python keywords from later chapters, such as if or while. The solution requires only subtraction, multiplication, division, and modulo.
Find elsewhere
🌐
HackerRank
hackerrank.com › challenges › python-division › tutorial
Python: Division | HackerRank
In Python 2, the only standard division operator is '/'. If both values are integers, the result is an integer. If either of the values is a float, the return is a float.
🌐
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.
🌐
Educative
educative.io › answers › what-is-integer-and-float-division-in-python
What is integer and float division in Python?
The division function in Python has two variations: Float division: gives a decimal answer. Integer division: gives the answer in whole numbers (the division result is rounded to the nearest whole number).
🌐
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.
🌐
Python
peps.python.org › pep-0238
PEP 238 – Changing the Division Operator | peps.python.org
It also shuts off the road to a unified numeric model a la PEP 228. Let int division return a special “portmanteau” type that behaves as an integer in integer context, but like a float in a float context.
🌐
Execute Program
executeprogram.com › courses › python-for-programmers › lessons › two-division-operators
Python for Programmers: Two Division Operators
Learn programming languages like TypeScript, Python, JavaScript, SQL, and regular expressions. Interactive with real code examples.
🌐
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.
🌐
Wiingy
wiingy.com › home › learn › python › division operators in python
Division Operators in Python
January 30, 2025 - While integer division yields an integer result, floating-point division always results in a floating-point value. ... Float division is the division of one number by another, resulting in a floating-point number.
🌐
LeetCode
leetcode.com › problems › divide-two-integers
Divide Two Integers - LeetCode
Divide Two Integers - Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator. The integer division should truncate toward zero, which means losing its fractional part.
🌐
Python documentation
docs.python.org › 3 › library › stdtypes.html
Built-in Types — Python 3.14.3 documentation
3 weeks ago - Also referred to as integer division. For operands of type int, the result has type int. For operands of type float, the result has type float. In general, the result is a whole integer, though the result’s type is not necessarily int.
🌐
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.
🌐
Educative
educative.io › answers › what-are-division-operators-in-python
What are division operators in Python?
Python offers several division-related operators—/ for true division, // for floor division, and % for modulus, each catering to different needs. Floor division (//) returns an integer or a float, depending on the inputs, while true division ...