New submission from felix.engelmann <>:

As described in
round-half-up: If the discarded digits represent greater than or equal to half 
(0.5) then the result should be incremented by 1; otherwise the discarded 
digits are ignored.

Rounding 9.95 to 1 decimal with ROUND_HALD_UP results in 9.9 instead of 10.0:
Out[49]: Decimal('9.9')

It does not matter at wich position this rounding with influence on another 
digit happens:

Out[50]: Decimal('9.99')

It is a specific problem with the 5, because 9.96 works as expected

Out[40]: Decimal('10.0')


Python 3.6.4

import decimal
decimal.__version__ : '1.70'

components: Library (Lib)
messages: 312546
nosy: felix.engelmann
priority: normal
severity: normal
status: open
title: decimal ROUND_HALF_UP not according to spec for 9.95 to 10.0
type: behavior
versions: Python 3.6

Python tracker <>
Python-bugs-list mailing list

Reply via email to