array-api icon indicating copy to clipboard operation
array-api copied to clipboard

docs: add note that cross-kind comparisons are undefined

Open asmeurer opened this issue 1 year ago • 2 comments

Does the language here look OK? Should we add anything along the lines of "comparisons with promotable types should promote first" (so that the result is numerically correct)?

Fixes #819.

asmeurer avatar Jul 15 '24 22:07 asmeurer

Done

asmeurer avatar Sep 19 '24 19:09 asmeurer

For my understanding, by “comparison of arrays without a corresponding promotable data type”, do you mean that there does not exist a type where both array are promotable to, or do you mean the array has a type that can no longer be promoted “further”? I’m asking because the reference issue involves an example of int64 vs uint64, for which both interpretations apply, so it doesn’t seem entirely clear to me.

fancidev avatar Oct 22 '24 13:10 fancidev

"Promotion" in the context of the standard only applies to two or more data types. So it's referring to the former interpretation.

asmeurer avatar Oct 22 '24 18:10 asmeurer

Should we add anything along the lines of "comparisons with promotable types should promote first" (so that the result is numerically correct)?

I believe this is already implied, as, practically speaking, in order to perform comparison, promotion is necessary (e.g., as automatically happens when comparing a float and a double in C). If we later find that we need to make this more explicit, we can address in a follow-up PR.

kgryte avatar Oct 31 '24 04:10 kgryte