VBL Integer-Only Arithmetic
Integer-Only Design
Section titled “Integer-Only Design”The VB-OS evaluation engine uses 64-bit signed integers exclusively. There are no floating-point operations anywhere in the evaluation path. This is enforced at the compiler level: floating-point arithmetic is a compilation error in the engine.
Why Integer-Only
Section titled “Why Integer-Only”Floating-point arithmetic introduces non-determinism:
- Rounding differences: different CPUs can produce different results for the same floating-point operation
- Ordering sensitivity:
(a + b) + cmay differ froma + (b + c)in floating-point - Platform variance: x86 and ARM may produce different results for edge cases
Integer arithmetic is exact. 42000 >= 15000 produces the same result on every machine, every time. This is essential for replay determinism: a replayed evaluation must produce the same result as the original.
Value Range
Section titled “Value Range”VBL integers are 64-bit signed:
- Minimum: -9,223,372,036,854,775,808
- Maximum: 9,223,372,036,854,775,807
Representing Decimal Values
Section titled “Representing Decimal Values”Since VBL has no floating-point type, represent decimal values as integers:
| Real Value | Integer Representation | Method |
|---|---|---|
| $150.00 | 15000 | Cents |
| 99.5% | 9950 | Basis points |
| 3.14159 | 314159 | Fixed-point (×100000) |
Choose a consistent scale factor for each field and document it in the boundary.
The eta_cap construct uses integer representation:
eta_cap: 9950 # 99.50% in basis pointsComparisons
Section titled “Comparisons”All comparison operators operate on integer values:
predicate: sufficient: balance >= amount # integer comparisonpredicate: limited: amount <= 50000 # integer comparisonString comparisons are the exception: all six comparison operators work on strings using lexicographic ordering.
Analytics Layer Exception
Section titled “Analytics Layer Exception”The cloud platform’s analytics layer (usage statistics, rates, trends) may use floating-point arithmetic because analytics are computed after evaluation. The integer-only constraint applies to everything inside the evaluation path: workload → boundary → ASSERT/DEFER.
Next Steps
Section titled “Next Steps”- Operators: the comparison operators that use integers
- Predicates: conditions using integer comparisons
- Eta Cap: integer-based threshold configuration
