supertypeOf

fnDataType supertypeOf(DataType a, DataType b) @safe pure

The common dtype both operands of an arithmetic operation are cast to before the kernel runs (D12, ADR-2026-10-18-05; one dispatch on one kind, fourteen instantiations per operation, not 196).

Rules (pinned by the matrix unittest and printed in doc/DDN-DF.md): same kind stays; BOOLEAN with a numeric kind gives the numeric kind; two signed or two unsigned integers give the wider; signed with unsigned gives the signed kind when it is strictly wider, otherwise the next wider signed kind; UINT64 with any signed kind gives FLOAT64; FLOAT32 with the 8- and 16-bit integers stays FLOAT32, with the 32- and 64-bit integers becomes FLOAT64; FLOAT64 with anything numeric is FLOAT64. STRING and the temporal kinds have no arithmetic supertype in this numeric lattice. Temporal arithmetic is not banned: it is handled by the dedicated typed DATE/DATETIME/TIME/DURATION rules instead of this function. Comparisons do not use this function either: they require the same kind (temporal with temporal, string with string) or the numeric supertype.

Parameters

adtype of the left operand
bdtype of the right operand

Returns

the common dtype both operands are cast to.

Throws

DataFrameException when the pair has no arithmetic supertype.