[issue41315] Add mathematical functions as wrappers to decimal.Decimal methods

Raymond Hettinger report at bugs.python.org
Fri Jul 17 21:11:36 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

FWIW, I don't really buy into the use case.  In my experience a nest of existing functions that are designed for floats will somewhere being using a float constant like 0.5, e, pi, or tau.  So, just feeding in a decimal input isn't sufficient to get it to work.  Also, for your idea to work, the function couldn't explicitly reference math.exp(x); instead, it must just use exp() so that you could substitute, "from decimal import exp" for "from math import exp". 

Also, this proposal would be a limited utility because most of the functions in the math module don't have an existing equivalent in the decimal methods.  The inconvenient fact is that the decimal module wasn't designed to be a drop-in substitute for floats — it's principal design objectives were somewhat different.

----------

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


More information about the Python-bugs-list mailing list