2.5.2.1.1 Numeric Values
All numeric data values inherit VBNumericTypedValue. This common base simplifies implementing semantics that involve "any numeric type" specifications.
VBNumericTypedValue implements INumericValue, a non-generic base abstraction. INumericValue ensures every numeric type minimally has a double managed representation.
Numeric Data Values
A numeric data value can be one of the following:
- VBByteValue
- VBIntegerValue
- VBLongValue
- VBLongLongValue
- VBSingleValue
- VBDoubleValue
- VBCurrencyValue
- VBDecimalValue
Each intrinsic type stores its own exact managed type: a short for Integer and an int for Long, not one integer type for both.
👉 Because each intrinsic type stores its own managed type, the declared type is preserved across the dispatch of an external call. See RD-VBAL §6.1.2.11 Strings (
Len/LenB).
Static Values
Each numeric value type minimally defines a typed representation of its MinValue, MaxValue and Zero. A numeric value type may define other static values as required by runtime semantics.
Significant Digits
Floating-point types also define a SignificantIntegerDigits. It is used to represent floating-point values correctly as VBStringValue in conversions and coercions to String; see RD-VBAL §5.5.1.2 Runtime semantics.
| Value type | VBType | SignificantIntegerDigits |
|---|---|---|
VBSingleValue |
VBSingleType | 7 |
VBDoubleValue |
VBDoubleType | 15 |
The SignificantIntegerDigits constant is declared on the VBType: VBSingleType.SignificantIntegerDigits and VBDoubleType.SignificantIntegerDigits.
Precompiler Constants
Precompiler constants are interpreted as Integer values. A precompiler constant value is an additional numeric data value:
Conditional compilation expressions are described in RD-VBAL §5.6.16 Constrained Expressions.
⏮️ RD-VBAL §2.5.2.1 Intrinsic Type Values | ⏭️ RD-VBAL §2.5.2.1.2 Array Values