From 630c0895a3d72755a19464682f228170e995b33a Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Tue, 16 May 2023 09:50:40 -0600 Subject: DOC: clarify how inputs of PyArray_ResultType are used --- doc/source/reference/c-api/array.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index baebfdb02..e8eca0f80 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -1149,11 +1149,11 @@ Converting data types .. versionadded:: 1.6 - This applies type promotion to all the inputs, - using the NumPy rules for combining scalars and arrays, to - determine the output type of a set of operands. This is the - same result type that ufuncs produce. The specific algorithm - used is as follows. + This applies type promotion to all the input arrays and dtype + objects, using the NumPy rules for combining scalars and arrays, to + determine the output type for an operation with the given set of + operands. This is the same result type that ufuncs produce. The + specific algorithm used is as follows. Categories are determined by first checking which of boolean, integer (int/uint), or floating point (float/complex) the maximum -- cgit v1.2.1 From d99683c065209549c5199e41fcd3efb7cd92f55b Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Tue, 16 May 2023 11:17:41 -0600 Subject: DOC: delete out-of-date description of ResultType algorithm --- doc/source/reference/c-api/array.rst | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/doc/source/reference/c-api/array.rst b/doc/source/reference/c-api/array.rst index e8eca0f80..038702bcf 100644 --- a/doc/source/reference/c-api/array.rst +++ b/doc/source/reference/c-api/array.rst @@ -1152,26 +1152,10 @@ Converting data types This applies type promotion to all the input arrays and dtype objects, using the NumPy rules for combining scalars and arrays, to determine the output type for an operation with the given set of - operands. This is the same result type that ufuncs produce. The - specific algorithm used is as follows. - - Categories are determined by first checking which of boolean, - integer (int/uint), or floating point (float/complex) the maximum - kind of all the arrays and the scalars are. - - If there are only scalars or the maximum category of the scalars - is higher than the maximum category of the arrays, - the data types are combined with :c:func:`PyArray_PromoteTypes` - to produce the return value. - - Otherwise, PyArray_MinScalarType is called on each array, and - the resulting data types are all combined with - :c:func:`PyArray_PromoteTypes` to produce the return value. - - The set of int values is not a subset of the uint values for types - with the same number of bits, something not reflected in - :c:func:`PyArray_MinScalarType`, but handled as a special case in - PyArray_ResultType. + operands. This is the same result type that ufuncs produce. + + See the documentation of :func:`numpy.result_type` for more + detail about the type promotion algorithm. .. c:function:: int PyArray_ObjectType(PyObject* op, int mintype) -- cgit v1.2.1