Mixed-mode Operation

Mixed-mode Operation

There may be cases in which you need to perform operations with data of different types. In Explain™ it is legal to perform mixed-mode comparisons and arithmetic operations that involve both a REAL and an INDEX quantity. In all mixed-mode operations, the INDEX is automatically “promoted” to a REAL prior to the operation.

REAL Sum INDEX becomes REAL (1.2 + 2 is evaluated to 3.2)

REAL Mult INDEX becomes REAL (1.2 / 2 is evaluated to 0.6)

REAL Equality INDEX becomes BOOL (1.01 eq 1 is evaluated to FALSE)

REAL Comparison INDEX becomes BOOL (1.01 gt 1 is evaluated to TRUE)

Other mixed-mode operations are not recommended.

The Explain™ library includes some data-type cast functions that allow you to force conversion of one data type into another. Examples include the Round() and INDEX() functions.