[Numpy-discussion] please change mean to use dtype=float
Charles R Harris
charlesr.harris at gmail.com
Tue Sep 19 19:37:01 CDT 2006
On 9/19/06, Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
> Sebastian Haase wrote:
>
> >On Tuesday 19 September 2006 15:48, Travis Oliphant wrote:
> >
> >
> >>Sebastian Haase wrote:
> >>
> >>
> ><snip>
> >
> >
> >>>can we please change dtype to default to float64 !?
> >>>
> >>>
> >>The default is float64 now (as long as you are not using
> >>numpy.oldnumeric).
> >>
> >>I suppose more appropriately, we could reduce over float for integer
> >>data-types when calculating the mean as well (since a floating point is
> >>returned anyway).
> >>
> >>
> >>
> >
> >Is now mean() always "reducing over" float64 ?
> >The svn note """Log:
> >Fix mean, std, and var methods so that they reduce over double data-type
> with
> >integer inputs.
> >"""
> >makes it sound that a float32 input is stays float32 ?
> >
> >
> Yes, that is true. Only integer inputs are changed because you are
> going to get a floating point output anyway.
>
> >For mean calculation this might introduce large errors - I usually would
> >require double-precision for *any* input type ...
> >
> >
> Of course. The system is not fool-proof. I hesitate to arbitrarily
> change this. The advantage of using single-precision calculation is
> that it is faster. We do rely on the user who expressly requests these
> things to be aware of the difficulties.
Speed depends on the achitecture. Float is a trifle slower than double on my
Athlon64, but faster on PPC750. I don't know about other machines. I think
there is a good argument for accumlating in double and converting to float
for output if required.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060919/77888c0b/attachment.html
More information about the Numpy-discussion
mailing list