[Numpy-discussion] Comparing the precision of dtypes?

Hans Meine meine@informatik.uni-hamburg...
Wed Jul 22 10:37:23 CDT 2009

On Wednesday 22 July 2009 17:16:31 Ralf Gommers wrote:
> 2009/7/22 Hans Meine <meine@informatik.uni-hamburg.de>
> >  type = min(float32, a.dtype.type, b.dtype.type)
> Are you looking for the type to cast to? In that case I guess you meant
> max() not min().

No, at least for integers min(..) does what one would expect max(..) to do.

> > How hackish is this?  Is this likely to break on other platforms/numpy
> > versions?  Is there a better API for type promotion?
> That could give unexpected results. Useful functions are find_common_type,

..find_common_type() is exactly what we were looking for;
thanks a lot for the pointer!

Have a nice day,

More information about the NumPy-Discussion mailing list