Skip to content

VBL Integer-Only Arithmetic

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.

Floating-point arithmetic introduces non-determinism:

  • Rounding differences: different CPUs can produce different results for the same floating-point operation
  • Ordering sensitivity: (a + b) + c may differ from a + (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.

VBL integers are 64-bit signed:

  • Minimum: -9,223,372,036,854,775,808
  • Maximum: 9,223,372,036,854,775,807

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 points

All comparison operators operate on integer values:

predicate: sufficient: balance >= amount # integer comparison
predicate: limited: amount <= 50000 # integer comparison

String comparisons are the exception: all six comparison operators work on strings using lexicographic ordering.

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.

  • Operators: the comparison operators that use integers
  • Predicates: conditions using integer comparisons
  • Eta Cap: integer-based threshold configuration