Promote two dtypes to their join according to the type lattice.
When performing operations between arrays of different types, we need to
promote both operands to a common type that can represent values from both
input types. This follows JAX's type promotion rules.
weakType represents weakly typed arrays. These are created for JS numbers,
which default to float32 but "weak" so they cast to the dtype of any array
they are first combined with, except bool.
Promote two dtypes to their join according to the type lattice.
When performing operations between arrays of different types, we need to promote both operands to a common type that can represent values from both input types. This follows JAX's type promotion rules.
Type lattice:
weakTyperepresents weakly typed arrays. These are created for JS numbers, which default to float32 but "weak" so they cast to the dtype of any array they are first combined with, exceptbool.Examples:
promoteTypes(bool, int32) → int32promoteTypes(uint32, int32) → int32promoteTypes(int32, float16) → float16promoteTypes(float16, float32) → float32promoteTypes(uint32, float32) → float32