Skip to content

Clarify that the results of division operations on integer array data types resulting in floating-point outputs is implementation-defined #362

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 5 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
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: 7 additions & 1 deletion spec/API_specification/array_object.md
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ Calculates an implementation-dependent approximation of exponentiation by raisin
```{note}
If both `self` and `other` have integer data types, the result of `__pow__` when `other_i` is negative (i.e., less than zero) is unspecified and thus implementation-dependent.

If `self` has an integer data type and `other` has a floating-point data type, behavior is implementation-dependent (type promotion between data type "kinds" (integer versus floating-point) is unspecified).
If `self` has an integer data type and `other` has a floating-point data type, behavior is implementation-dependent, as type promotion between data type "kinds" (e.g., integer versus floating-point) is unspecified.
```

#### Special Cases
Expand Down Expand Up @@ -1249,6 +1249,12 @@ Element-wise results must equal the results returned by the equivalent element-w

Evaluates `self_i / other_i` for each element of an array instance with the respective element of the array `other`.

```{note}
If one or both of `self` and `other` have integer data types, the result is implementation-dependent, as type promotion between data type "kinds" (e.g., integer versus floating-point) is unspecified.

Specification-compliant libraries may choose to raise an error or return an array containing the element-wise results. If an array is returned, the array must have a floating-point data type.
```

#### Special Cases

For floating-point operands, let `self` equal `x1` and `other` equal `x2`.
Expand Down
8 changes: 7 additions & 1 deletion spec/API_specification/elementwise_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ For floating-point operands,

Calculates the division for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.

```{note}
If one or both of the input arrays have integer data types, the result is implementation-dependent, as type promotion between data type "kinds" (e.g., integer versus floating-point) is unspecified.

Specification-compliant libraries may choose to raise an error or return an array containing the element-wise results. If an array is returned, the array must have a floating-point data type.
```

#### Special Cases

For floating-point operands,
Expand Down Expand Up @@ -1223,7 +1229,7 @@ Calculates an implementation-dependent approximation of exponentiation by raisin
```{note}
If both `x1` and `x2` have integer data types, the result of `pow` when `x2_i` is negative (i.e., less than zero) is unspecified and thus implementation-dependent.

If `x1` has an integer data type and `x2` has a floating-point data type, behavior is implementation-dependent (type promotion between data type "kinds" (integer versus floating-point) is unspecified).
If `x1` has an integer data type and `x2` has a floating-point data type, behavior is implementation-dependent, as type promotion between data type "kinds" (e.g., integer versus floating-point) is unspecified.
```

#### Special Cases
Expand Down
4 changes: 2 additions & 2 deletions spec/API_specification/statistical_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A conforming implementation of the array API standard must provide and support t
Calculates the maximum value of the input array `x`.

```{note}
When the number of elements over which to compute the maximum value is zero, the maximum value is implementation-defined. Specification-compliant libraries may choose to error, return a sentinel value (e.g., if `x` is a floating-point input array, return `NaN`), or return the minimum possible value for the input array `x` data type (e.g., if `x` is a floating-point array, return `-infinity`).
When the number of elements over which to compute the maximum value is zero, the maximum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if `x` is a floating-point input array, return `NaN`), or return the minimum possible value for the input array `x` data type (e.g., if `x` is a floating-point array, return `-infinity`).
```

#### Special Cases
Expand Down Expand Up @@ -92,7 +92,7 @@ Let `N` equal the number of elements over which to compute the arithmetic mean.
Calculates the minimum value of the input array `x`.

```{note}
When the number of elements over which to compute the minimum value is zero, the minimum value is implementation-defined. Specification-compliant libraries may choose to error, return a sentinel value (e.g., if `x` is a floating-point input array, return `NaN`), or return the maximum possible value for the input array `x` data type (e.g., if `x` is a floating-point array, return `+infinity`).
When the number of elements over which to compute the minimum value is zero, the minimum value is implementation-defined. Specification-compliant libraries may choose to raise an error, return a sentinel value (e.g., if `x` is a floating-point input array, return `NaN`), or return the maximum possible value for the input array `x` data type (e.g., if `x` is a floating-point array, return `+infinity`).
```

#### Special Cases
Expand Down