2009/7/22 Hans Meine <me...@informatik.uni-hamburg.de> > On Wednesday 22 July 2009 17:16:31 Ralf Gommers wrote: > > 2009/7/22 Hans Meine <me...@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. > But...
Hmm, not for me: In [56]: min(int16, int32) Out[56]: <type 'numpy.int16'> In [57]: max(int16, int32) Out[57]: <type 'numpy.int32'> On the other hand, even though dtype=int gives you an int32 array this does not work as expected: In [59]: min(int16, int) Out[59]: <type 'int'> Well I guess that shows how fragile using min/max is. And I don't think there's a way to make it always work because there are types that are not simply bigger/smaller but of a different kind. Cheers, Ralf
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion