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

Sebastian Haase haase at msg.ucsf.edu
Tue Sep 19 22:07:37 CDT 2006


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 ...

- Sebastian




More information about the Numpy-discussion mailing list