[Numpy-discussion] please change mean to use dtype=float
Christopher Barker
Chris.Barker at noaa.gov
Wed Sep 20 12:56:53 EDT 2006
Sebastian Haase wrote:
> The best I can hope for is a "sound" default for most (practical) cases...
> I still think that 80bit vs. 128bit vs 96bit is rather academic for most
> people ... most people seem to only use float64 and then there are some
> that use float32 (like us) ...
I fully agree with Sebastian here. As Travis pointed out, "all we are
talking about is the default". The default should follow the principle
of least surprise for the less-knowledgeable users. Personally, I try to
always use doubles, unless I have a real reason not to. The recent
change of default types for zeros et al. will help.
clearly, there is a problem to say the default accumulator for *all*
types is double, as you wouldn't want to downcast float128s, even if
they are obscure. However, is it that hard to say that the default
accumulator will have *at least* the precision of double?
Robert Kern wrote:
> Let me offer a third path: the algorithms used for .mean() and .var() are
> substandard. There are much better incremental algorithms that entirely avoid
> the need to accumulate such large (and therefore precision-losing) intermediate
> values.
This, of course, is an even better solution, unless there are
substantial performance impacts.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the NumPy-Discussion
mailing list