Binary Operation Argument Promotion

When performing binary operations, the table arguments may be promoted in order to make operands compatible.

When performing binary operations, the table arguments may be promoted in order to make operands compatible. For example, when subtracting a tensor or vector from a scalar, the scalar will be promoted to a tensor or vector with all components having the same value as the original scalar. The promotion rules for binary operations are as follows:
Binary Operator Input Argument Types (lhs,rhs) Promotion
Scalar, Vector Scalar is promoted to a Vector, all components having the same value as the scalar.
Scalar, Tensor Scalar is promoted to a Tensor, all components having the same value as the scalar.
Tensor(2D), Tensor(3D 2D Tensor will be promoted to a 3D tensor with all z-components set to zero.
Vector, Tensor Invalid – A vector will not be promoted to a tensor and the operation will fail.

After promotion, binary operators function with compatible value records. Constant value tables and resource-based value tables will be promoted in the same manner, allowing for scale and offset by scalar values to be applied to all three value types in the same way. Binary operations do not check for system compatibility of directional values, allowing a promoted scalar to be applied to vectors and tensors independent of their system ID, system type, or dimension.