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
Require __pow__ and __truediv__ to have floating-point inputs
Previously it was any numeric dtype, but this was inconsistent with the
functions pow() and divide(). Integer inputs are problematic because they
would either always have to be cast to float or use value-based casting
depending on, e.g., the sign of the exponent for __pow__. Furthermore, in
order to properly correspond to Python conventions, __truediv__ should always
return a float (integer division should be implemented by __floordiv__).
This was discussed in data-apis#173.
Copy file name to clipboardExpand all lines: spec/API_specification/array_object.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -780,7 +780,7 @@ The `matmul` function must implement the same semantics as the built-in `@` oper
780
780
781
781
-**self**: _<array>_
782
782
783
-
- array instance. Should have a numeric data type. Must have at least one dimension. If `self` is one-dimensional having shape `(M)` and `other` has more than one dimension, `self` must be promoted to a two-dimensional array by prepending `1` to its dimensions (i.e., must have shape `(1, M)`). After matrix multiplication, the prepended dimensions in the returned array must be removed. If `self` has more than one dimension (including after vector-to-matrix promotion), `self` must be compatible with `other` (see {ref}`broadcasting`). If `self` has shape `(..., M, K)`, the innermost two dimensions form matrices on which to perform matrix multiplication.
783
+
- array instance. Should have a numeric data type. Must have at least one dimension. If `self` is one-dimensional having shape `(M)` and `other` has more than one dimension, `self` must be promoted to a two-dimensional array by prepending `1` to its dimensions (i.e., must have shape `(1, M)`). After matrix multiplication, the prepended dimensions in the returned array must be removed. If `self` has more than one dimension (including after vector-to-matrix promotion), `self` must be compatible with `other` (see {ref}`broadcasting`). If `self` has shape `(..., M, K)`, the innermost two dimensions form matrices on which to perform matrix multiplication.
784
784
785
785
-**other**: _<array>_
786
786
@@ -809,7 +809,7 @@ The `matmul` function must implement the same semantics as the built-in `@` oper
809
809
810
810
- if either `self` or `other` is a zero-dimensional array.
811
811
- if `self` is a one-dimensional array having shape `(N)`, `other` is a one-dimensional array having shape `(M)`, and `N != M`.
812
-
- if `self` is an array having shape `(..., M, K)`, `other` is an array having shape `(..., L, N)`, and `K != L`.
812
+
- if `self` is an array having shape `(..., M, K)`, `other` is an array having shape `(..., L, N)`, and `K != L`.
813
813
814
814
(method-__mod__)=
815
815
### \_\_mod\_\_(self, other, /)
@@ -1016,11 +1016,11 @@ For floating-point operands, let `self` equal `x1` and `other` equal `x2`.
1016
1016
1017
1017
-**self**: _<array>_
1018
1018
1019
-
- array instance whose elements correspond to the exponentiation base. Should have a numeric data type.
1019
+
- array instance whose elements correspond to the exponentiation base. Should have a floating-point data type.
1020
1020
1021
1021
-**other**: _Union\[ int, float, <array>]_
1022
1022
1023
-
- other array whose elements correspond to the exponentiation exponent. Must be compatible with `self` (see {ref}`broadcasting`). Should have a numeric data type.
1023
+
- other array whose elements correspond to the exponentiation exponent. Must be compatible with `self` (see {ref}`broadcasting`). Should have a floating-point data type.
1024
1024
1025
1025
#### Returns
1026
1026
@@ -1149,11 +1149,11 @@ For floating-point operands, let `self` equal `x1` and `other` equal `x2`.
1149
1149
1150
1150
-**self**: _<array>_
1151
1151
1152
-
- array instance. Should have a numeric data type.
1152
+
- array instance. Should have a floating-point data type.
1153
1153
1154
1154
-**other**: _Union\[ int, float, <array>]_
1155
1155
1156
-
- other array. Must be compatible with `self` (see {ref}`broadcasting`). Should have a numeric data type.
1156
+
- other array. Must be compatible with `self` (see {ref}`broadcasting`). Should have a floating-point data type.
0 commit comments