From e68c1aaf898cbc273e4560dfc761ebe25c739fc9 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Wed, 1 Sep 2021 16:33:49 -0600 Subject: [PATCH 1/2] 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. Alternatively, we could just remove these sentences from here. --- spec/API_specification/elementwise_functions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 97c77c6bc..8f7e1e659 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -968,7 +968,7 @@ For floating-point operands, (function-logical_and)= ### logical_and(x1, x2, /) -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`. +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`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. #### Parameters @@ -989,7 +989,7 @@ Computes the logical AND for each element `x1_i` of the input array `x1` with th (function-logical_not)= ### logical_not(x, /) -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`. +Computes the logical NOT for each element `x_i` of the input array `x`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. #### Parameters @@ -1006,7 +1006,7 @@ Computes the logical NOT for each element `x_i` of the input array `x`. Zeros ar (function-logical_or)= ### logical_or(x1, x2, /) -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`. +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`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. #### Parameters @@ -1027,7 +1027,7 @@ Computes the logical OR for each element `x1_i` of the input array `x1` with the (function-logical_xor)= ### logical_xor(x1, x2, /) -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`. +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`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. #### Parameters From 25421158f6420d4cc4a9fd453c71a27e76da8f5c Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 13 Sep 2021 03:19:01 -0700 Subject: [PATCH 2/2] Move clarifications to notes --- .../elementwise_functions.md | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 8f7e1e659..53658af0a 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -968,7 +968,11 @@ For floating-point operands, (function-logical_and)= ### logical_and(x1, x2, /) -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`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. +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`. + +```{note} +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`. +``` #### Parameters @@ -989,7 +993,11 @@ Computes the logical AND for each element `x1_i` of the input array `x1` with th (function-logical_not)= ### logical_not(x, /) -Computes the logical NOT for each element `x_i` of the input array `x`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. +Computes the logical NOT for each element `x_i` of the input array `x`. + +```{note} +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`. +``` #### Parameters @@ -1006,7 +1014,11 @@ Computes the logical NOT for each element `x_i` of the input array `x`. Only boo (function-logical_or)= ### logical_or(x1, x2, /) -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`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. +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`. + +```{note} +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`. +``` #### Parameters @@ -1027,7 +1039,11 @@ Computes the logical OR for each element `x1_i` of the input array `x1` with the (function-logical_xor)= ### logical_xor(x1, x2, /) -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`. Only boolean data types are required, but if non-boolean data types are implemented, zeros are considered the equivalent of `False`, while non-zeros are considered the equivalent of `True`. +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`. + +```{note} +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`. +``` #### Parameters