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
Clarify guidance regarding non-boolean input array dtypes in the logical_* functions (#251)
* Clarify some text in the logical_* functions
Only boolean data types are required in these functions, so the zero-nonzero
bool equivalence is only for implementations that choose to implement
non-boolean inputs.
* Move clarifications to notes
Co-authored-by: Athan <kgryte@gmail.com>
Copy file name to clipboardExpand all lines: spec/API_specification/elementwise_functions.md
+20-4Lines changed: 20 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -968,7 +968,11 @@ For floating-point operands,
968
968
(function-logical_and)=
969
969
### logical_and(x1, x2, /)
970
970
971
-
Computes the logical AND for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`. Zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`.
971
+
Computes the logical AND for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
972
+
973
+
```{note}
974
+
While this specification recommends that this function only accept input arrays having a boolean data type, specification-compliant array libraries may choose to accept input arrays having numeric data types. If non-boolean data types are supported, zeros must be considered the equivalent of `False`, while non-zeros must be considered the equivalent of `True`.
975
+
```
972
976
973
977
#### Parameters
974
978
@@ -989,7 +993,11 @@ Computes the logical AND for each element `x1_i` of the input array `x1` with th
989
993
(function-logical_not)=
990
994
### logical_not(x, /)
991
995
992
-
Computes the logical NOT for each element `x_i` of the input array `x`. Zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`.
996
+
Computes the logical NOT for each element `x_i` of the input array `x`.
997
+
998
+
```{note}
999
+
While this specification recommends that this function only accept input arrays having a boolean data type, specification-compliant array libraries may choose to accept input arrays having numeric data types. If non-boolean data types are supported, zeros must be considered the equivalent of `False`, while non-zeros must be considered the equivalent of `True`.
1000
+
```
993
1001
994
1002
#### Parameters
995
1003
@@ -1006,7 +1014,11 @@ Computes the logical NOT for each element `x_i` of the input array `x`. Zeros ar
1006
1014
(function-logical_or)=
1007
1015
### logical_or(x1, x2, /)
1008
1016
1009
-
Computes the logical OR for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`. Zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`.
1017
+
Computes the logical OR for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
1018
+
1019
+
```{note}
1020
+
While this specification recommends that this function only accept input arrays having a boolean data type, specification-compliant array libraries may choose to accept input arrays having numeric data types. If non-boolean data types are supported, zeros must be considered the equivalent of `False`, while non-zeros must be considered the equivalent of `True`.
1021
+
```
1010
1022
1011
1023
#### Parameters
1012
1024
@@ -1027,7 +1039,11 @@ Computes the logical OR for each element `x1_i` of the input array `x1` with the
1027
1039
(function-logical_xor)=
1028
1040
### logical_xor(x1, x2, /)
1029
1041
1030
-
Computes the logical XOR for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`. Zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`.
1042
+
Computes the logical XOR for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.
1043
+
1044
+
```{note}
1045
+
While this specification recommends that this function only accept input arrays having a boolean data type, specification-compliant array libraries may choose to accept input arrays having numeric data types. If non-boolean data types are supported, zeros must be considered the equivalent of `False`, while non-zeros must be considered the equivalent of `True`.
0 commit comments