[Python-ideas] Python3.3 Decimal Library Released

Paul Moore p.f.moore at gmail.com
Mon Mar 3 21:12:53 CET 2014


On 3 March 2014 18:23, Zachary Ware <zachary.ware+pyideas at gmail.com> wrote:
> I'm -1 on a decimal-specific math library, though.  What I would
> rather see is a type-agnostic math library, that does what (IIRC) the
> new statistics module does: take in numbers of any type, coerce only
> as is strictly necessary, calculate, and return an answer of the same
> type as the input with the goal of correctness over performance.

Given that incorrect results aren't acceptable in any situation, fair
enough, but what I'd like to see would be library functions that
provided good performance for decimal first. If they can do so while
remaining type-agnostic, then fine, but I'd favour decimal performance
over the ability to calculate the sine of a rational... Ultimately,
I'd like to feel that I pay a one-off cost for working with decimals
(the cost of a software implementation rather than a hardware one) but
I *don't* have to pay further because the algorithms used for decimals
are suboptimal compared to the floating point ones. I'd say the same
about rationals, but the set of functions involved is different (and
basically wouldn't involve most of what's in the normal math library)

Having said this, I can't actually think of a real-life domain where
math-library functions (by which I assume we basically mean
trancendental functions?) would be used and yet there would be a
genuine need for decimal arithmetic rather than floating point. So
although I'm +1 for a decimal math library in theory, I'm unsure of
its practical value.

Paul


More information about the Python-ideas mailing list