Python 3's way (called "round half to even" or "banker's rounding") is considered the standard rounding method these days, though some language implementations aren't on the bus yet.

The simple "always round 0.5 up" technique results in a slight bias toward the higher number. With large numbers of calculations, this can be significant. The Python 3 approach eliminates this issue.

There is more than one method of rounding in common use. IEEE 754, the international standard for floating-point math, defines five different rounding methods (the one used by Python 3 is the default). And there are others.

This behavior is not as widely known as it ought to be. AppleScript was, if I remember correctly, an early adopter of this rounding method. The round command in AppleScript offers several options, but round-toward-even is the default as it is in IEEE 754. Apparently the engineer who implemented the round command got so fed up with all the requests to "make it work like I learned in school" that he implemented just that: round 2.5 rounding as taught in school is a valid AppleScript command. :-)

Answer from kindall on Stack Overflow
🌐
Real Python
realpython.com › python-rounding
How to Round Numbers in Python – Real Python
December 7, 2024 - For example, the number 2.5 rounded to the nearest whole number is 3. The number 1.64 rounded to one decimal place is 1.6. Now open up an interpreter session and round 2.5 to the nearest whole number using Python’s built-in round() function:
Top answer
1 of 13
252

Python 3's way (called "round half to even" or "banker's rounding") is considered the standard rounding method these days, though some language implementations aren't on the bus yet.

The simple "always round 0.5 up" technique results in a slight bias toward the higher number. With large numbers of calculations, this can be significant. The Python 3 approach eliminates this issue.

There is more than one method of rounding in common use. IEEE 754, the international standard for floating-point math, defines five different rounding methods (the one used by Python 3 is the default). And there are others.

This behavior is not as widely known as it ought to be. AppleScript was, if I remember correctly, an early adopter of this rounding method. The round command in AppleScript offers several options, but round-toward-even is the default as it is in IEEE 754. Apparently the engineer who implemented the round command got so fed up with all the requests to "make it work like I learned in school" that he implemented just that: round 2.5 rounding as taught in school is a valid AppleScript command. :-)

2 of 13
58

You can control the rounding you get in Py3000 using the Decimal module:

>>> decimal.Decimal('3.5').quantize(decimal.Decimal('1'), 
    rounding=decimal.ROUND_HALF_UP)
>>> Decimal('4')

>>> decimal.Decimal('2.5').quantize(decimal.Decimal('1'),    
    rounding=decimal.ROUND_HALF_EVEN)
>>> Decimal('2')

>>> decimal.Decimal('3.5').quantize(decimal.Decimal('1'), 
    rounding=decimal.ROUND_HALF_DOWN)
>>> Decimal('3')
People also ask

What is the Python round function?
The Python round function is a built-in function that rounds a number to a specified number of decimal places or to the nearest integer. It helps maintain numerical precision, making calculations and data presentation cleaner and more accurate in Python programs.
🌐
knowledgehut.com
knowledgehut.com › home › blog › data science › understanding python round function: guide to precise rounding
How to Round Numbers in Python? With Examples
How to round numbers in pandas using Python round function?
Pandas integrates Python rounding with the round() method on Series or DataFrames. Example: df['column'].round(2) rounds values in a column to two decimals, simplifying data cleaning and reporting.
🌐
knowledgehut.com
knowledgehut.com › home › blog › data science › understanding python round function: guide to precise rounding
How to Round Numbers in Python? With Examples
How does Python round function handle 0.5 values?
Python rounds 0.5 to the nearest even number. For example, round(2.5) returns 2, and round(3.5) returns 4. This minimizes bias over multiple calculations, unlike traditional rounding which always rounds halves up.
🌐
knowledgehut.com
knowledgehut.com › home › blog › data science › understanding python round function: guide to precise rounding
How to Round Numbers in Python? With Examples
🌐
Reddit
reddit.com › r/learnpython › why python rounds 2.5 to 2 instead of 3?
Why Python rounds 2.5 to 2 instead of 3? : r/learnpython
October 22, 2020 - Subreddit for posting questions and asking for general advice about all topics related to learning python. ... Sorry, this post was deleted by the person who originally posted it. Share ... Python uses bankers' rounding, IE 'round half to even'. This prevents statistical inaccuracies creeping in when dealing with a large number of decimals.
🌐
Quora
quora.com › How-do-I-get-3-rather-than-2-from-round-2-5-with-Python3-More-info-in-comments
How to get 3 rather than 2 from `round(2.5) ` with Python3 - Quora
Answer (1 of 5): You obviously can’t change the behavior of the built-in function. And, if you could, it would be violating the documented reference behavior that you quoted in the comments: > … if two multiples are equally close, rounding is done toward the even choice (so, for example, both [...
🌐
Medium
medium.com › @akhilnathe › understanding-pythons-round-function-from-basics-to-bankers-b64e7dd73477
Understanding Python’s Round Function: From Basics to Bankers | by Akhil Nath Elayat | Medium
November 6, 2023 - round(2.5) returns 2: Here, 2.5 is equidistant between 2 and 3 and also rounds to 2. ... Python’s choice aligns with the goal of reducing bias over multiple calculations, making it particularly apt for financial and statistical applications.
🌐
AskPython
askpython.com › home › using python round()
Using Python round() - AskPython
August 6, 2022 - print(round(123.456, 0)) print(round(123.456, -1)) print(round(123.456, -2)) print(round(123.456, -3)) ... Since floating-point numbers are defined by their precision, Python approximates these numbers during calculations.
Find elsewhere
🌐
KnowledgeHut
knowledgehut.com › home › blog › data science › understanding python round function: guide to precise rounding
How to Round Numbers in Python? With Examples
October 8, 2025 - Other languages, however, often round halves away from zero, which can lead to different results. ... Both numbers are halfway between two integers, but Python rounds one down (2.5 → 2) and the other up (3.5 → 4).
🌐
Python
bugs.python.org › issue36082
Issue 36082: The built-in round() function giving a wrong output - Python tracker
This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide · This issue has been migrated to GitHub: https://github.com/python/cpython/issues/80263
🌐
PyTutorial
pytutorial.com › python-round-function-guide-usage-examples
PyTutorial | Python Round Function Guide: Usage & Examples
February 5, 2026 - It is called "round half to even" or "bankers' rounding". It aims to reduce bias. When a number is exactly halfway between two possibilities, it rounds to the nearest even number. This can be surprising at first.
🌐
CodeRivers
coderivers.org › blog › python-round-up
Python Round Up: A Comprehensive Guide - CodeRivers
January 20, 2025 - In this example, round(num1) will return 3 because 3.2 is closer to 3 than to 4. round(num2) will return 4 as 3.7 is closer to 4 than to 3. When you want to round a number to a specific number of decimal places, you pass the number to be rounded as the first argument and the number of decimal ...
🌐
GeeksforGeeks
geeksforgeeks.org › round-function-python
round() function in Python - GeeksforGeeks
In this example, we are using numpy module to round the values to their 3rd decimal places in Python. ... import numpy as np arr = np.array([-2.675, -1.23456789, -3.14159265]) rounded_arr = np.round(arr, decimals=3) print(rounded_arr) ...
Published   August 7, 2024
🌐
W3Schools
w3schools.com › python › ref_func_round.asp
Python round() Function
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training · ❮ Built-in Functions · Round a number to only two decimals: x = round(5.76543, 2) print(x) Try it Yourself » ·
🌐
Software Testing Help
softwaretestinghelp.com › home › python › python round function: rounding numbers in python
Python Round Function: Rounding Numbers in Python
April 1, 2025 - In ex_2, we can see that rounding 2.5 to the nearest integer gives 2 instead of the expected 3. This is because, as seen in the diagram above, 2.5 is at the middle of the two closest integers, which are; 3 and 2 · Since there is no closest integer here, Python uses the IEEE 754 standard called banker’s rounding, which rounds to the nearest least significant even digit.
🌐
Reddit
reddit.com › r/learnpython › why does round(0.5) = 0?
r/learnpython on Reddit: Why does round(0.5) = 0?
August 30, 2016 -

round (0.5) = 0

round (1.5) = 2

round (2.5) = 2

round (3.5) = 4

Is it just me or does this feel like some sort of inconsistency? Why does 0.5 round to 0, when it should round to 1?

edit: it's because python uses https://en.wikipedia.org/w/index.php?title=IEEE_754#Rounding_rules

edit2: Surprised this got this much attention. Here's a code work-around someone made:

def col_round(x):
  frac = x - math.floor(x)
  if frac < 0.5: return math.floor(x)
  return math.ceil(x)
🌐
Programiz
programiz.com › python-programming › methods › built-in › round
Python round()
print(round(num, 2)) # using decimal.Decimal (passed float as string for precision) num = Decimal('2.675') ... Your builder path starts here. Builders don't just know how to code, they create solutions that matter.
🌐
Server Academy
serveracademy.com › blog › python-round-function-tutorial
Python Round() Function Tutorial - Server Academy
When it’s lower than .5, Python rounds down. To round to a specific number of decimal places, provide an integer for ndigits. number = 3.56789 print(round(number, 1)) # Rounds to 1 decimal place print(round(number, 3)) # Rounds to 3 decimal places
🌐
DEV Community
dev.to › kiani0x01 › python-round-to-nearest-integer-p76
Python Round to Nearest Integer - DEV Community
July 22, 2025 - Under the hood, Python uses "banker’s rounding," also called "round half to even." Instead of pushing 2.5 to 3 every time, it sends it to 2, because 2 is even.
🌐
Python Tutorial
pythontutorial.net › home › advanced python › python rounding
Python Rounding
November 24, 2022 - ... Python uses banker’s rounding but not rounding away from zero because it’s less biased. For example, if you average three numbers 1.5, 2.5, and 3.5, the rounding away from zero returns 3.0 while the banker’s rounding returns 2.66:
🌐
InterServer
interserver.net › home › programming › python round() function explained: examples, decimals, and best practices
Python round() Function Explained: Examples, Decimals, and Best Practices - Interserver Tips
October 1, 2025 - In banker’s rounding, when a number ends with .5, Python rounds it to the nearest even number. For example: ... Here, 2.5 rounds down to 2 because 2 is even, and 3.5 rounds up to 4 because 4 is even.