Huny's Dev Blog
huny.dev

Python round() Explained: Why 2.675 Rounds Down and How to Use Decimal

Distinguish ties-to-even from float representation and apply explicit decimal rounding with quantize.

Hun Jang
Hun Jang Nov 20, 2026

To understand why Python's round(2.675, 2) returns 2.67 instead of 2.68, separate two facts. round() chooses the even result for an exact tie, while the value stored in a float may not be exactly the decimal value entered. For data such as money with a specified decimal rounding policy, use a Decimal constructed from a string and quantize().

AI-generated conceptual illustration comparing numbers between two rounding outcomes

This article is based on the Python round documentation and decimal documentation, checked November 20, 2026. The examples below were run with Python 3.12.14.

Exact ties go to the even result

For built-in numeric types, when the two possible results are exactly equally close, the result with an even last digit is chosen. Thus 2.5 becomes 2 and 3.5 becomes 4. This differs from the common expectation that a 5 always rounds up. With a negative value, -2.5 becomes -2. User-defined objects can implement their own __round__, so this explanation concerns built-in numeric types. round documentation

Why 2.675 becomes 2.67

Decimal(2.675) displays the float's actual binary approximation exactly in decimal. That value is slightly less than exact 2.675, so it is closer to 2.67 at two decimal places. Saying only that “ties go to even” misses the cause. See Python's floating-point explanation.

Specify both decimal input and rounding policy

A string preserves the decimal input. ROUND_HALF_EVEN sends exact ties to the even result; ROUND_HALF_UP sends them away from zero. For negative numbers it does not mean always rounding toward positive infinity. Creating a float first, as in Decimal(2.675), already brings in its approximation and does not recover the exact decimal input. Decimal construction and rounding modes

Decimal("0.01") specifies the exponent for two decimal places. It does not mean rounding to a multiple of 0.05. Such a rule needs separate design, for example dividing by the unit, rounding to an integer, and multiplying back. Decimal arithmetic is also subject to context precision and rounding, and not every division is exact. quantize documentation

Check before applying

First identify whether the original input is a string or already a float, and determine the business policy for ties and negative numbers. Rounding each item before summing can also produce a different result from rounding once after summing. These local examples demonstrate representation and policy differences; they do not validate a real payment or tax policy.

한국어 버전: Python round()가 예상과 다를 때: 2.675와 Decimal 반올림Python round()가 예상과 다를 때: 2.675와 Decimal 반올림

추천 글