You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/API_specification/type_promotion.rst
+6-3
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ Notes
123
123
Mixing arrays with Python scalars
124
124
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125
125
126
-
Using Python scalars (i.e., instances of ``bool``, ``int``, ``float``) together with arrays must be supported for:
126
+
Using Python scalars (i.e., instances of ``bool``, ``int``, ``float``, ``complex``) together with arrays must be supported for:
127
127
128
128
- ``array <op> scalar``
129
129
- ``scalar <op> array``
@@ -132,7 +132,8 @@ where ``<op>`` is a built-in operator (including in-place operators, but excludi
132
132
133
133
- a Python ``bool`` for a ``bool`` array data type.
134
134
- a Python ``int`` within the bounds of the given data type for integer array :ref:`data-types`.
135
-
- a Python ``int`` or ``float`` for floating-point array data types.
135
+
- a Python ``int`` or ``float`` for real-valued floating-point array data types.
136
+
- a Python ``int``, ``float``, or ``complex`` for complex floating-point array data types.
136
137
137
138
Provided the above requirements are met, the expected behavior is equivalent to:
138
139
@@ -142,4 +143,6 @@ Provided the above requirements are met, the expected behavior is equivalent to:
142
143
.. note::
143
144
Behavior is not specified when mixing a Python ``float`` and an array with an integer data type; this may give ``float32``, ``float64``, or raise an exception. Behavior is implementation-specific.
144
145
145
-
The behavior is also not specified for integers outside of the bounds of a given integer data type. Integers outside of bounds may result in overflow or an error.
146
+
Similarly, behavior is not specified when mixing a Python ``complex`` and an array with a real-valued data type; this may give ``complex64``, ``complex128``, or raise an exception. Behavior is implementation-specific.
147
+
148
+
Behavior is also not specified for integers outside of the bounds of a given integer data type. Integers outside of bounds may result in overflow or an error.
0 commit comments