[issue40801] Expose PyFloat_AsDouble at Python level: operator.as_float?
Serhiy Storchaka
report at bugs.python.org
Thu May 28 13:27:56 EDT 2020
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
The problem with the roundtrip PyFloat_FromDouble(PyFloat_AsDouble(obj)) is that (in contrary to PyNumber_Index()) it is lossy. Converting Decimal, Fraction, float128 to float before using it in expression can lead to loss of precision.
So such conversion looks to me less useful than operator.index().
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40801>
_______________________________________
More information about the Python-bugs-list
mailing list