


The data type of result is usually the same as that of the most precise operand. The order of
precision, from least to most precise, is Integer, Long, Single, Double, Currency.
When the operands are Variant expressions, the following rules supersede this order:
If one or both operands are Null expressions, result is a Null. If an operand is Empty (VarType 0), it is treated as if it were 0.
In Syntax 2, the - operator is used as the unary negation operator to indicate the negative
value of an operand. As with Syntax 1, the operand can be any numeric constant, variable, or
expression or any function that returns a number.
- Operator
When subtraction involves a Single and a Long, the data type of result is converted to a Double.
When the data type of result is a Variant of VarType 3 (Long), VarType 4 (Single), or VarType 7 (Date)
that overflows its legal range, result is converted to a Variant of VarType 5 (Double).
When the data type of result is a Variant of VarType 2 (Integer) that overflows its legal range, result is converted to a Variant of VarType 3 (Long).
| GrossPay = 10000
| // Assign gross pay.
|
| StateTax = .06 * GrossPay
| // Calculate state tax.
|
| FederalTax = .12 * GrossPay
| // Calculate federal tax.
|
| TotalTax = StateTax + FederalTax
| // Calculate total tax.
|
| NetPay = GrossPay - TotalTax
| // Calculate net pay.
|
This example uses the - operator to indicate a negative value.
-1200.55