[Numpy-discussion] please change mean to use dtype=float

Charles R Harris charlesr.harris at gmail.com
Tue Sep 19 22:15:29 CDT 2006

On 9/19/06, Sebastian Haase <haase at msg.ucsf.edu> wrote:
> Travis Oliphant wrote:
> > Sebastian Haase wrote:
> >> I still would argue that getting a "good" (smaller rounding errors)
> answer
> >> should be the default -- if speed is wanted, then *that* could be still
> >> specified by explicitly using dtype=float32  (which would also be a
> possible
> >> choice for int32 input) .
> >>
> > So you are arguing for using long double then.... ;-)
> >
> >> In image processing we always want means to be calculated in float64
> even
> >> though input data is always float32 (if not uint16).
> >>
> >> Also it is simpler to say "float64 is the default" (full stop.) -
> instead
> >>
> >> "float64 is the default unless you have float32"
> >>
> > "the type you have is the default except for integers".  Do you really
> > want float64 to be the default for float96?
> >
> > Unless we are going to use long double as the default, then I'm not
> > convinced that we should special-case the "double" type.
> >
> I guess I'm not really aware of the float96 type ...
> Is that a "machine type" on any system ?  I always thought that -- e.g.
> coming from C -- double is "as good as it gets"...
> Who uses float96 ?  I heard somewhere that (some) CPUs use 80bits
> internally when calculating 64bit double-precision...
> Is this not going into some academic argument !?
> For all I know, calculating mean()s (and sum()s, ...) is always done in
> double precision -- never in single precision, even when the data is in
> float32.
> Having float32 be the default for float32 data is just requiring more
> typing, and more explaining ...  it would compromise numpy usability as
> a day-to-day replacement for other systems.
> Sorry, if I'm being ignorant ...

I'm going to side with Travis here. It is only a default and easily
overridden. And yes, there are precisions greater than double. I was using
quad precision back in the eighties on a VAX for some inherently ill
conditioned problems. And on my machine long double is 12 bytes.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060919/be02dfd0/attachment.html 

More information about the Numpy-discussion mailing list