[issue20502] Context.create_decimal_from_float() inconsistent precision for zeros after decimal mark

Mauricio de Alencar report at bugs.python.org
Tue Feb 4 12:42:03 CET 2014


Mauricio de Alencar added the comment:

According to the docs (http://docs.python.org/3/library/decimal.html):

"The decimal module incorporates a notion of significant places so that 1.30 + 1.20 is 2.50. The trailing zero is kept to indicate significance. This is the customary presentation for monetary applications. For multiplication, the “schoolbook” approach uses all the figures in the multiplicands. For instance, 1.3 * 1.2 gives 1.56 while 1.30 * 1.20 gives 1.5600."

Therefore, if I request 2 digits of precision, I expect 2 digits in the output.

In addition, the docs assert that "Decimal numbers can be represented exactly", which leaves me lost about you argument on whether some number is *exactly representable* or not.

----------
resolution: invalid -> 
status: pending -> open

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20502>
_______________________________________


More information about the Python-bugs-list mailing list