[issue40801] Expose PyFloat_AsDouble at Python level: operator.as_float?

Mark Dickinson report at bugs.python.org
Thu May 28 14:26:20 EDT 2020


Mark Dickinson <dickinsm at gmail.com> added the comment:

> Converting Decimal, Fraction, float128 to float before using it in expression can lead to loss of precision.

My experience is that this loss of precision is hardly ever a practical problem in the real world of scientific development; in practice floating-point numbers  are almost universally IEEE 754 doubles (perhaps sometimes single-precision in large datasets, like seismic SEG-Y files; occasionally IBM format hex floats; but IEEE 754 doubles are by far the majority). It's very rare to be using float128 or Decimal or Fraction in practice for scientific data.

That's not to say that people outside that world won't be using these things, but there's a big ecosystem where float64 is pretty much all you need.

----------

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


More information about the Python-bugs-list mailing list