[issue47160] round function is not working as expected

Karthikeyan Singaravelan report at bugs.python.org
Wed Mar 30 07:04:59 EDT 2022


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

This is documented

https://docs.python.org/3/library/functions.html#round

> 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.

----------
nosy: +xtreak
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47160>
_______________________________________


More information about the Python-bugs-list mailing list