File tree 1 file changed +9
-2
lines changed
spec/API_specification/array_api
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -226,8 +226,15 @@ def __bool__(self: array, /) -> bool:
226
226
"""
227
227
Converts a zero-dimensional array to a Python ``bool`` object.
228
228
229
- .. note::
230
- If ``self`` has a numeric data type, a value equal to ``0`` must cast to ``False``, and a value not equal to ``0`` must cast to ``True``.
229
+ **Special cases**
230
+
231
+ For real-valued floating-point operands,
232
+
233
+ - If ``self`` is ``NaN``, the result is ``True``.
234
+ - If ``self`` is either ``+infinity`` or ``-infinity``, the result is ``True``.
235
+ - If ``self`` is either ``+0`` or ``-0``, the result is ``False``.
236
+
237
+ For complex floating-point operands, special cases must be handled as if the operation is implemented as ``bool(real(self)) and bool(imag(self))``.
231
238
232
239
Parameters
233
240
----------
You can’t perform that action at this time.
0 commit comments