Arguably, the whole of floating point numbers and their related shenanigans is 
not very pythonic in the first place. The accuracy of the output WILL depend on 
the input, to some degree or another. At the risk of repeating myself: explicit 
is better than implicit

-----Original Message-----
From: "RayS" <r...@blue-cove.com>
Sent: ‎25-‎7-‎2014 19:56
To: "Discussion of Numerical Python" <numpy-discussion@scipy.org>
Subject: Re: [Numpy-discussion] numpy.mean still broken for largefloat32arrays

At 07:22 AM 7/25/2014, you wrote:

> We were talking on this in the office, as we
> realized it does affect a couple of lines dealing
> with large arrays, including complex64.
> As I expect Python modules to work uniformly
> cross platform unless documented otherwise, to me
> that includes 32 vs 64 bit platforms, implying
> that the modules should automatically use large
> enough accumulators for the data type input.

The 32/64-bitness of your platform has nothing to do with floating
point.

As a naive end user, I can, and do, download different binaries for different 
CPUs/Windows versions and will get different results
http://mail.scipy.org/pipermail/numpy-discussion/2014-July/070747.html


 Nothing discussed in this thread is platform-specific (modulo
some minor details about the hardware FPU, but that should be taken as
read).

And compilers, apparently.

The important point was that it would be best if all of the methods affected by 
summing 32 bit floats with 32 bit accumulators had the same Notes as 
numpy.mean(). We went through a lot of code yesterday, assuming that any numpy 
or Scipy.stats functions that use accumulators suffer the same issue, whether 
noted or not, and found it true.

"Depending on the input data, this can cause the results to be inaccurate, 
especially for float32 (see example below). Specifying a higher-precision 
accumulator using the dtype keyword can alleviate this issue." seems rather 
un-Pythonic.

- Ray
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to