You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The page on type promotion rules extensively discusses how arithmetic operations must work. However, it is not clear on how comparisons should behave.
xp.asarray(x, dtype=xp.int64) + xp.asarray(x, dtype=float64) is explicitly disallowed for evident reasons of ambiguity about the output precision. However, I can't think of any cases where __eq__, __gt__, etc. between the two can be ambiguous? Just need to state that inf and nan use the same rules as if both arguments were float.
The latest version of array-api-strict disallows these operations, resulting in unnecessarily cumbersome code.
The text was updated successfully, but these errors were encountered:
However, I can't think of any cases where __eq__, __gt__, etc. between the two can be ambiguous?
That's not the only problem - it's simply not supported by all libraries. And if you look under the hood, these operators are still implemented as kernels with two operands of the same type only - and to get them to be the same type, one has to apply type promotion rules (which don't exist for mixed integer and floating-point arrays).
It is also technically possible for there to be integers that aren't exactly representable as floating-point numbers of a given precision, yielding questions about corner cases.
The page on type promotion rules extensively discusses how arithmetic operations must work. However, it is not clear on how comparisons should behave.
xp.asarray(x, dtype=xp.int64)
+xp.asarray(x, dtype=float64)
is explicitly disallowed for evident reasons of ambiguity about the output precision. However, I can't think of any cases where__eq__
,__gt__
, etc. between the two can be ambiguous? Just need to state thatinf
andnan
use the same rules as if both arguments were float.The latest version of array-api-strict disallows these operations, resulting in unnecessarily cumbersome code.
The text was updated successfully, but these errors were encountered: