[issue4796] Decimal to receive from_float method
Facundo Batista
report at bugs.python.org
Sat Jan 10 22:43:11 CET 2009
Facundo Batista <facundo at taniquetil.com.ar> added the comment:
Raymond, Mark, thanks for this work!
I'd include the following in the PEP (under the "from float"
discussion), what do you think?
"""
Update: The .from_float() method was added to Python 2.7 and 3.1
versions, providing lossless and exact conversion from float to Decimal
(see issue 4796 [7]_ for further information).
It has the following syntax::
Decimal.from_float(floatNumber)
where ``floatNumber`` is the float number origin of the construction.
Example::
>>> Decimal.from_float(1.1)
Decimal('1.100000000000000088817841970012523233890533447265625')
"""
----------
nosy: +facundobatista
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4796>
_______________________________________
More information about the Python-bugs-list
mailing list