Operator Precision (topic)

When numeric, binary, logical or comparison operators are used, the data type of the result is generally the same as the data type of the more precise operand. For example, adding an Integer and a Long first converts the Integer operand to a Long, then performs a long addition, overflowing only if the result cannot be contained with a Long. The order of precision is shown in the following table:

Empty Least precise

Boolean

Integer

Long

Single

Date

Double

Currency Most precise

There are exceptions noted in the descriptions of each operator.

The rules for operand conversion are further complicated when an operator is used with variant data. In many cases, an overflow causes automatic promotion of the result to the next highest precise data type. For example, adding two Integer variants results in an Integer variant unless it overflows, in which case the result is automatically promoted to a Long variant.

More information

O