The problem is that Decimal(1.2225) is not what you expect it to be:

>>> Decimal(1.2225)
Decimal('1.2224999999999999200639422269887290894985198974609375')

You are using a float to the create the decimal, but that float is already too imprecise for your use case. As you can see, it’s actually a 1.222499 so it is smaller than 1.2225 and as such would correctly round down.

In order to fix that, you need to create decimals with correct precision, by passing them as strings. Then everything works as expected:

>>> x = Decimal('1.2225')
>>> x.quantize(Decimal('0.001'), ROUND_HALF_UP)
Decimal('1.223')
>>> y = Decimal('1.2224')
>>> y.quantize(Decimal('0.001'), ROUND_HALF_UP)
Decimal('1.222')
Answer from poke on Stack Overflow
🌐
Tutorialspoint
tutorialspoint.com › python › number_round.htm
Python round() Function
round(80.23456, 2) : 80.23 round(100.000056, 3) : 100.0 · In here the number of decimal points to which the given number will be rounded is not present.
People also ask

How to use round function in Python with decimal places?
You can specify decimal places using the second argument. For instance, round(3.14159, 2) returns 3.14. This is useful when displaying currency, scientific data, or percentages where consistent precision is required for readability and accuracy.
🌐
upgrad.com
upgrad.com › home › blog › data science › understanding python round function: guide to precise rounding
Round Function in Python [2025] – Explained for Beginners
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.
🌐
upgrad.com
upgrad.com › home › blog › data science › understanding python round function: guide to precise rounding
Round Function in Python [2025] – Explained for Beginners
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.
🌐
upgrad.com
upgrad.com › home › blog › data science › understanding python round function: guide to precise rounding
Round Function in Python [2025] – Explained for Beginners
🌐
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 ... The round() function returns a floating point number that is a rounded version of the specified number, with the specified number of decimals.
🌐
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 - The simplest way to round a number in Python is to use the built-in round() function. The round() function takes a number as the first argument and an optional second argument to specify the number of decimal places to round to.
🌐
Finxter
blog.finxter.com › 5-best-ways-to-round-float-to-3-decimals-in-python
5 Best Ways to Round Float to 3 Decimals in Python – Be on the Right Side of Change
The most common method for rounding numbers in Python is the built-in round() function. It is straightforward and enables you to specify the number of decimal places to which you’d like to round your float. The function takes two arguments: the number itself and the number of decimal places.
🌐
Upgrad
upgrad.com › home › blog › data science › understanding python round function: guide to precise rounding
Round Function in Python [2025] – Explained for Beginners
October 8, 2025 - You can specify decimal places using the second argument. For instance, round(3.14159, 2) returns 3.14. This is useful when displaying currency, scientific data, or percentages where consistent precision is required for readability and accuracy.
🌐
Bobby Hadz
bobbyhadz.com › blog › python-round-float-3-decimal-places
Round a Float to 1, 2 or 3 Decimal places in Python | bobbyhadz
Use the `round()` function to round a float to 2 or 3 decimal places, e.g. `result = round(6.36789, 2)`.
Find elsewhere
🌐
Python
docs.python.org › 3 › library › decimal.html
decimal — Decimal fixed-point and floating-point arithmetic — Python 3.14.3 documentation
For example, this converts Decimal('123E+1') to Decimal('1.23E+3'). ... Identical to the to_integral_value() method. The to_integral name has been kept for compatibility with older versions.
🌐
TradingCode
tradingcode.net › python › math › round-decimals
How to round decimal places up and down in Python? • TradingCode
With Python’s round() function we can round decimal places up and down. The function needs two arguments for that. The first is the value to round. The second is the number of digits after the decimal point (.) to round to (Lutz, 2013; Sweigart, ...
🌐
Mimo
mimo.org › glossary › python › round-function
Mimo: The coding platform you need to learn Web Development, Python, and more.
In this example, the first line rounds 3.14159 to the nearest integer (3), while the second line rounds it to two decimal places (3.14).
🌐
Real Python
realpython.com › python-rounding
How to Round Numbers in Python – Real Python
December 7, 2024 - It’s an algorithm! 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:
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.round.html
numpy.round — NumPy v2.1 Manual
>>> np.format_float_positional(56294995342131.5, precision=3) '56294995342131.5' The float printing routines use an accurate but much more computationally demanding algorithm to compute the number of digits after the decimal point. Alternatively, Python’s builtin round function uses a more ...
🌐
GeeksforGeeks
geeksforgeeks.org › python › round-function-python
round() function in Python - GeeksforGeeks
We usually work with just two or three digits to the right of the decimal point when there is no exact equivalent to the fraction in decimal. ... Note: In Python, if we round off numbers to floor or ceil without giving the second parameter, it will return 15.0 for example and in Python 3 it returns 15, so to avoid this we can use (int) type conversion in Python.
Published   August 7, 2024
🌐
Programiz
programiz.com › python-programming › methods › built-in › round
Python round()
from decimal import Decimal # normal float num = 2.675 · print(round(num, 2)) # using decimal.Decimal (passed float as string for precision) num = Decimal('2.675')
🌐
Server Academy
serveracademy.com › blog › python-round-function-tutorial
Python Round() Function Tutorial - Server Academy
It’s a straightforward tool to ... This parameter is optional. If not specified, round() will return the nearest integer. number = 3......
🌐
freeCodeCamp
freecodecamp.org › news › how-to-round-to-2-decimal-places-in-python
How to Round to 2 Decimal Places in Python
August 22, 2022 - The syntax is: ... The function ... num = 24.89 rounded = round(num, 1) print(rounded) # 24.9 ... num = 20.4454 rounded3 = round(num, 3) # to 3 decimal ......
🌐
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 - You can specify decimal places using the second argument. For instance, round(3.14159, 2) returns 3.14. This is useful when displaying currency, scientific data, or percentages where consistent precision is required for readability and accuracy.
🌐
Vultr Docs
docs.vultr.com › python › built-in › round
Python round() - Round Numeric Value | Vultr Docs
November 27, 2024 - This example rounds 9.87654 to 9.877. Specifying 3 as the second argument rounds the number to three decimal places. Understand that Python uses the rounding half to even strategy.
🌐
Reddit
reddit.com › r/learnpython › round() fuction not working properly
round() fuction not working properly : r/learnpython
May 28, 2024 - If you pass the round function as a tuple (e.g round(var, n)), it'll round to that amount of numbers! ... Maybe store the integer and fraction / decimal as two integers in a tuple? Or combine as one integer and then either store or remember the exponent of 10? If it will always be X decimal places, option 2 would imo be better since you only need to store and reference a single integer.