Skip to content

Update guidance for unsigned integer data types for sum and prod #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions spec/API_specification/statistical_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ For an input array `x`, let `N` equal the number of elements over which to compu
- data type of the returned array. If `None`,

- if the default data type corresponding to the data type "kind" (integer or floating-point) of `x` has a smaller range of values than the data type of `x` (e.g., `x` has data type `int64` and the default data type is `int32`, or `x` has data type `uint64` and the default data type is `int64`), the returned array must have the same data type as `x`.
- otherwise, the returned array must have the default data type corresponding to the data type "kind" (integer or floating-point) of `x`.
- if `x` has a floating-point data type, the returned array must have the default floating-point data type.
- if `x` has a signed integer data type (e.g., `int16`), the returned array must have the default integer data type.
- if `x` has an unsigned integer data type (e.g., `uint16`), the returned array must have an unsigned integer data type having the same number of bits as the default integer data type (e.g., if the default integer data type is `int32`, the returned array must have a `uint32` data type).

If the data type (either specified or resolved) differs from the data type of `x`, the input array should be cast to the specified data type before computing the product. Default: `None`.

Expand Down Expand Up @@ -217,7 +219,9 @@ For an input array `x`, let `N` equal the number of elements over which to compu
- data type of the returned array. If `None`,

- if the default data type corresponding to the data type "kind" (integer or floating-point) of `x` has a smaller range of values than the data type of `x` (e.g., `x` has data type `int64` and the default data type is `int32`, or `x` has data type `uint64` and the default data type is `int64`), the returned array must have the same data type as `x`.
- otherwise, the returned array must have the default data type corresponding to the data type "kind" (integer or floating-point) of `x`.
- if `x` has a floating-point data type, the returned array must have the default floating-point data type.
- if `x` has a signed integer data type (e.g., `int16`), the returned array must have the default integer data type.
- if `x` has an unsigned integer data type (e.g., `uint16`), the returned array must have an unsigned integer data type having the same number of bits as the default integer data type (e.g., if the default integer data type is `int32`, the returned array must have a `uint32` data type).

If the data type (either specified or resolved) differs from the data type of `x`, the input array should be cast to the specified data type before computing the sum. Default: `None`.

Expand Down