From 1683d4f75e5f191920de3cae44fb0803c288ac37 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 4 Nov 2021 23:43:31 -0700 Subject: [PATCH] Add note concerning float sort order --- spec/API_specification/sorting_functions.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/API_specification/sorting_functions.md b/spec/API_specification/sorting_functions.md index f88b01a17..fd205fbe9 100644 --- a/spec/API_specification/sorting_functions.md +++ b/spec/API_specification/sorting_functions.md @@ -8,6 +8,16 @@ A conforming implementation of the array API standard must provide and support t - Optional parameters must be [keyword-only](https://www.python.org/dev/peps/pep-3102/) arguments. - Unless stated otherwise, functions must support the data types defined in {ref}`data-types`. +```{note} +For floating-point input arrays, the sort order of NaNs and signed zeros is unspecified and thus implementation-dependent. + +Implementations may choose to sort signed zeros (`-0 < +0`) or may choose to rely solely on value equality (`==`). + +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. + +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. +``` + ## Objects in API