5.6.9.3 Arithmetic Operators
Note
This section describes the implementation of MS-VBAL §5.6.9.3 Arithmetic Operators.
Runtime Semantics
Arithmetic operators are simple data operators (RD-VBAL §5.6.9.2 Simple Data Operators):
- They validate their operands through
OperatorRuntimeSemantics.LetCoerceNonNullOperand. - Their result is computed in the effective type's own representation, never through a
Doubleintermediate:Longin a 32-bitint,CurrencyandDecimalindecimal,Singleinfloat.
Arithmetic runs in a checked context. An integral or fixed-point result that does not fit the effective type raises
Overflow rather than wrapping or silently narrowing.
| Condition | Run-time error |
|---|---|
| An integral or fixed-point result does not fit the effective type. | 6 — Overflow |
Run-time error 6 is VBRuntimeErrorId.Overflow. For division
by zero, see RD-VBAL §5.6.9.3.6 \ Operator and Mod Operator.
5.6.9.3.1 Unary - Operator
This section corresponds to MS-VBAL §5.6.9.3.1 Unary - Operator.
Note
Reserved. This section has no content yet.
5.6.9.3.2 + Operator
Note
This section describes the implementation of MS-VBAL §5.6.9.3.2 + Operator.
🧩 RD-VBA explicitly adds runtime semantics for a unary + operator, as a language core extension
(RD-VBAL §1.1.2 Language Core Extensions).
👉 A For loop's ForNext instruction adds step to the counter through the addition operator,
RDCore.Runtime.Semantics.Operators.Arithmetic.BinaryAdditionOperatorRuntimeSemantics. The step addition is therefore
an overflow-checked operation, not a plain CLR addition
(RD-VBAL §5.4.2.3 For Statement).
5.6.9.3.3 Binary - Operator
This section corresponds to MS-VBAL §5.6.9.3.3 Binary - Operator.
Note
Reserved. This section has no content yet.
5.6.9.3.4 * Operator
This section corresponds to MS-VBAL §5.6.9.3.4 * Operator.
Note
Reserved. This section has no content yet.
5.6.9.3.5 / Operator
This section corresponds to MS-VBAL §5.6.9.3.5 / Operator.
Note
Reserved. This section has no content yet.
5.6.9.3.6 \ Operator and Mod Operator
Note
This section describes the implementation of MS-VBAL §5.6.9.3.6 \ Operator and Mod Operator.
Static Semantics
Note
Not implemented. The Mod operator token has no mapped static semantics rule. The static semantics of a Mod
expression defer to VBUnknownType
(RD-VBAL §5.0 Semantics).
Runtime Semantics
| Condition | Run-time error |
|---|---|
An integral division or Mod by zero. |
11 — Division by zero |
Run-time error 11 is VBRuntimeErrorId.DivisionByZero.
5.6.9.3.7 ^ Operator
Note
This section describes the implementation of MS-VBAL §5.6.9.3.7 ^ Operator.
The ^ operator is the sole exception to computation in the effective type
(RD-VBAL §5.6.9.2 Simple Data Operators):
its effective type is always Double. The ^ operator is evaluated as IEEE-754 exponentiation.
⏮️ RD-VBAL §5.6.9.2 Simple Data Operators | ⏭️ RD-VBAL §5.6.9.4 & Operator