Floating point numbers are only approximations; 2.85 cannot be represented exactly:

>>> format(2.85, '.53f')
'2.85000000000000008881784197001252323389053344726562500'

It is slightly over 2.85.

0.5 and 0.75 can be represented exactly with binary fractions (1/2 and 1/2 + 1/4, respectively).

The round() function documents this explicitly:

Note: The behavior of round() for floats can be surprising: for example, round(2.675, 2) gives 2.67 instead of the expected 2.68. This is not a bug: it’s a result of the fact that most decimal fractions can’t be represented exactly as a float. See Floating Point Arithmetic: Issues and Limitations for more information.

Answer from Martijn Pieters on Stack Overflow
🌐
Real Python
realpython.com › python-rounding
How to Round Numbers in Python – Real Python
December 7, 2024 - Python rounds 2.5 to 2 because it follows the round half to even strategy, which rounds to the nearest even number to minimize rounding bias over many calculations.
Top answer
1 of 2
42

A while ago I constructed a test program for successive rounding, because it's basically a worst-case stress test for a rounding algorithm.

For each number from 0 to 9,999 it first rounds to the nearest 10, then to the nearest 100, then to the nearest 1000. (You could also think of this as 10,000 points in [0,1) being rounded to 3 places, then to 2, then to 1.) This set of numbers has a mean value of 4999.5.

If all three roundings are done using the method "round half up", then the results are as follows (first column is the rounding result, second column is how many numbers rounded to that result — i.e. it's a histogram).

0     445
1000  1000
2000  1000
3000  1000
4000  1000
5000  1000
6000  1000
7000  1000
8000  1000
9000  1000
10000 555

The result differs from a single "round half up" to the nearest thousand 550 times out of 10,000 and the average rounded value is 5055 (higher than the original average by 55.5).

If all three roundings are done by "round half down", then the results are:

0     556
1000  1000
2000  1000
3000  1000
4000  1000
5000  1000
6000  1000
7000  1000
8000  1000
9000  1000
10000 444

The result differs from a single "round half down" to the nearest thousand 550 times out of 10,000 and the and the average rounded value is 4944 (too low by 55.5).

If all three roundings are done using "round half odd", the result is:

0     445
1000  1111
2000  889
3000  1111
4000  889
5000  1111
6000  889
7000  1111
8000  889
9000  1111
10000 444

The result differs from a single "round half odd" to the nearest thousand 550 times out of 10,000 and the average rounded value is 4999.5 (correct).

Finally, if all three roundings are done using "round half even", the results are:

0     546
1000  909
2000  1091
3000  909
4000  1091
5000  909
6000  1091
7000  909
8000  1091
9000  909
10000 1091

The result differs from a single "round half even" to the nearest thousand 450 times out of 10,000 and the average rounded value is 4999.5 (correct).

I think it's obvious that round half up and round half down bias the rounded values, so that the average of rounded values no longer has the same expectation as the average of the original values, and that "round half even" and "round half odd" remove the bias by treating 5 one way half the time and the other way the other half. Successive rounding multiplies the bias.

Round half even and round half odd introduce their own kind of bias to the distribution: a bias towards even and odd digits, respectively. In both cases, again, this bias is multiplied by successive rounding, but it's worse for round half odd. I think that the explanation in this case is simple: 5 is an odd number, so round half odd has more results ending in 5 than round half even — and therefore, more results that will have to be handled specially by the next rounding.

So anyway, of the four choices, only two are unbiased, and of the two unbiased choices, round half even gives the best-behaved distribution when subject to repeated rounding.

2 of 2
57

It's called banker's rounding. The idea is to minimize the cumulative error from many rounding operations.

Lets say you always rounded .5 down. Think of all those little interest payments, the bank pocketing half a cent each time...

Lets say you always rounded .5 up. Accounting is going to scream because you're paying out more interest than you should.

🌐
Post.Byes
post.bytes.com › home › forum › topic › python
Rounding a number to nearest even - Post.Byes
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. > If I want to round to the nearest even, that is > my_round(1.5) = 2 # As expected my_round(2.5) = 2 # Not 3, which is an odd num If you care about such details, you may be better ...
🌐
Medium
medium.com › @nibasnazeem › did-you-know-this-about-the-python-round-function-9323412abf4
Did You Know this about the Python round() Function? | by Nibas Nazeem | Medium
September 22, 2023 - Python handles this by employing a unique method called “bankers rounding” also known as “round half to even.” · Python uses banker’s rounding to handle numbers that are right in the middle of two possible rounding outcomes.
🌐
w3resource
w3resource.com › python-exercises › modules › python-module-decimal-exercise-6.php
Python: Rounding to round to the nearest, with ties going to the nearest even integer - w3resource
import decimal print("Configure ... = decimal.ROUND_HALF_EVEN print(decimal.Decimal(10) / decimal.Decimal(4)) ... Write a Python program to round a Decimal value to the nearest integer using ROUND_HALF_EVEN and print the result, ...
🌐
Nabble
python.6.x6.nabble.com › Rounding-a-number-to-nearest-even-td1386915.html
Python - python-list - Rounding a number to nearest even
Python › General › Python - python-list · Rounding a number to nearest even · ‹ Previous Topic Next Topic › · Locked 40 messages · bd satish · Reply | Threaded · Open this post in threaded view · colas.francis
Find elsewhere
🌐
Server Academy
serveracademy.com › blog › python-round-function-tutorial
Python Round() Function Tutorial - Server Academy
When a number ends in .5, the Python round() function rounds it to the nearest even number, following a practice called “bankers’ rounding.”
🌐
Learn By Example
learnbyexample.org › python-round-function
Python round() Function - Learn By Example
April 20, 2020 - This kind of rounding is called rounding to even (or banker’s rounding). x = round(4.5) print(x) # Prints 4 x = round(5.5) print(x) # Prints 6 · If you want to explicitly round a number up or down, use ceil() or floor() function from math module.
🌐
iO Flood
ioflood.com › blog › python-round
Python round() | Function Guide (With Examples)
February 6, 2024 - The round function treats negative numbers in the same way as positive numbers, rounding to the nearest even number in case of a tie. As a best practice, always specify the number of decimal places when using the round function to ensure the ...
🌐
Scaler
scaler.com › home › topics › round function in python
round() Function in Python | Scaler Topics
December 3, 2023 - This function rounds down a number towards the nearest permissible number and if a tie occurs, it will be rounded towards the nearest even value.
🌐
SAS
blogs.sas.com › home › round to even
Round to even - The DO Loop
November 8, 2019 - However, half-integers, which are equally close to two integers, are rounded to the nearest EVEN integer, thus giving the method its name. This method reduces the bias when you use rounded values to estimate quantities such as sums, means, standard deviations, and so forth. Whereas SAS provides separate ROUND and ROUNDE functions, other languages might default to the round-to-even method. For example, the round() function in python and the round function in R both implement the round-to-even method.
🌐
Afternerd
afternerd.com › blog › round-number-nearest-integer
Python: Round a Number to the Nearest Integer - Afternerd
February 11, 2021 - Another thing to notice here is that according to Python’s documentation, any floating number that is mid-way between two integers (e.g. 2.5, 3.4. etc…) will be rounded to the nearest even choice.
🌐
AskPython
askpython.com › home › using python round()
Using Python round() - AskPython
August 6, 2022 - print(round(2.5)) # Rounding will happen to the nearest even number # OR print(round(2.5, None))
🌐
DEV Community
dev.to › kiani0x01 › python-round-to-nearest-integer-p76
Python Round to Nearest Integer - DEV Community
July 22, 2025 - Its basic form is simple: value = round(2.7) # returns 3 value2 = round(2.3) # returns 2 · By default, it returns an integer when no precision is given. You can also specify digits: ... Ties (like 2.5) go to the nearest even number by default.
🌐
Inspector
inspector.dev › home › round up numbers to integer in python – fast tips
Round Up Numbers to Integer in Python - Inspector.dev
June 17, 2025 - It rounds numbers with fractional parts that are exactly halfway between two integers to the nearest even integer. This method helps in reducing rounding biases.
🌐
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 - Numbers exactly halfway between two integers are rounded to the nearest even number. For example, round(2.5) becomes 2, while round(3.5) becomes 4. This reduces rounding bias in large datasets or repeated calculations.