NumPy

numpy.maximum_sctype

numpy.maximum_sctype(t)[source]

Return the scalar type of highest precision of the same kind as the input.

Parameters
tdtype or dtype specifier

The input data type. This can be a dtype object or an object that is convertible to a dtype.

Returns
outdtype

The highest precision data type of the same kind (dtype.kind) as t.

Examples

>>> np.maximum_sctype(int)
<class 'numpy.int64'>
>>> np.maximum_sctype(np.uint8)
<class 'numpy.uint64'>
>>> np.maximum_sctype(complex)
<class 'numpy.complex256'> # may vary
>>> np.maximum_sctype(str)
<class 'numpy.str_'>
>>> np.maximum_sctype('i2')
<class 'numpy.int64'>
>>> np.maximum_sctype('f4')
<class 'numpy.float128'> # may vary

Previous topic

numpy.mintypecode

Next topic

Optionally Scipy-accelerated routines (numpy.dual)