Skip to content

Commit 568f81f

Browse files
authored
Add note concerning float sort order (#316)
1 parent aa6c89c commit 568f81f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/API_specification/sorting_functions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ A conforming implementation of the array API standard must provide and support t
88
- Optional parameters must be [keyword-only](https://www.python.org/dev/peps/pep-3102/) arguments.
99
- Unless stated otherwise, functions must support the data types defined in {ref}`data-types`.
1010

11+
```{note}
12+
For floating-point input arrays, the sort order of NaNs and signed zeros is unspecified and thus implementation-dependent.
13+
14+
Implementations may choose to sort signed zeros (`-0 < +0`) or may choose to rely solely on value equality (`==`).
15+
16+
Implementations may choose to sort NaNs (e.g., to the end or to the beginning of a returned array) or leave them in-place. Should an implementation sort NaNs, the sorting convention should be clearly documented in the conforming implementation's documentation.
17+
18+
While defining a sort order for IEEE 754 floating-point numbers is recommended in order to facilitate reproducible and consistent sort results, doing so is not currently required by this specification.
19+
```
20+
1121
## Objects in API
1222

1323
<!-- NOTE: please keep the functions in alphabetical order -->

0 commit comments

Comments
 (0)