[issue38703] should we expect round(0.95, 1) to be 1.0, instead of 0.9?

Steven D'Aprano report at bugs.python.org
Tue Nov 5 19:15:16 EST 2019


Steven D'Aprano <steve+python at pearwood.info> added the comment:

Possibly even easier than using Decimal:

py> '%.17f' % 0.95
'0.94999999999999996'

BTW, this is a FAQ:

https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate

----------
nosy: +steven.daprano

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


More information about the Python-bugs-list mailing list