[Python-ideas] Proposal: add a calculator statistics module

Alexander Belopolsky alexander.belopolsky at gmail.com
Tue Sep 13 16:35:05 CEST 2011

On Tue, Sep 13, 2011 at 12:06 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> 2. The 'math' module is not the place for this, a new, dedicated
> module is more appropriate. This is mainly due to the fact that the
> math module is focused primarily on binary floating point, while these
> algorithms should be neutral with regard to the specific numeric type
> involved.

While I agree that a new dedicated module is an appropriate place for
this functionality, I am concerned that generic type-neutral
algorithms may be sub-optimal for float-only calculations.   I think
at least at the start, the new module should follow the same design as
the math module - namely provide numerically stable efficient
algorithms for double precision floating point data.  Other types
should be supported by coercing to float.  This means that support for
long integers, decimal type, fractions, complex numbers will
necessarily be limited.  For example, you will not be able to compute
average of 100-digit integers accurately even when the exact answer is
an integer.  Once the semantics of operations on general iterables
yielding numbers are in place, the first optimization should probably
be to special case operations on arrays of doubles.  Proper support
for decimal type, fractions, etc would probably need a separate

More information about the Python-ideas mailing list