DEV Community

Dean
Dean

Posted on Originally published at soluqube.com

Eliminating IEEE-754 Floating-Point Rounding Drift in Enterprise ASC 606 Subledgers

Why Binary 64-Bit Floats Break Multi-Year Revenue Recognition (And How 128-Bit Fixed-Point Math Restores Balance Sheet Parity)

If you have ever audited a multi-million-dollar SaaS revenue schedule in an ERP or spreadsheet, you've likely seen the notorious "phantom penny":

An enterprise contract valued at $1,000,000.00 amortized across 36 monthly periods results in recognized revenue of $999,999.96 or $1,000,000.04.

While a four-cent variance might appear negligible on a high-level P&L, in a Big 4 financial audit governed by PCAOB standards, it triggers severe friction:

  1. The Trial Balance Fails to Tie Out: Recognized revenue + deferred revenue doesn't equal contractual cash consideration.
  2. Variance Suspense Accounts: Finance teams are forced to post manual plug journal entries.
  3. SOX 404 ITGC Control Deficiencies: Automated systems that cannot calculate deterministic math fail automated testing.

The Hardware Origin: IEEE-754 Binary Representation

Standard programming languages and relational database engines represent decimal fractions using IEEE-754 binary floating-point representation.

In base 2 (binary), standard decimal fractions like 0.10 or 0.01 cannot be represented precisely. They become infinite repeating fractions:

$$0.10_{10} = 0.00011001100110011..._2$$

When you calculate monthly amortization in standard JavaScript/Python:

// THE FATAL FLOAT TRAP
const contractTotal = 100000.00;
const periods = 36;
const monthly = contractTotal / periods; // 2777.777777777778

// Cumulative sum over 36 periods
let sum = 0;
for (let i = 0; i < 36; i++) {
  sum += Number(monthly.toFixed(2));
}
console.log(sum); // Output: 99999.96 ($0.04 DRIFT ERROR!)
Enter fullscreen mode Exit fullscreen mode

Over hundreds of customer contracts with differing billing cadences and mid-term amendments, this error compounds into thousands of dollars in un-reconciled ledger drift.


The Solution: 128-Bit Micro-Cent Fixed-Point DAG

At Soluqube, we eliminated floating-point operations from the core revenue subledger using 128-bit micro-cent fixed-point arithmetic:

  1. Micro-Cent Scaling: All monetary amounts are scaled by $1,000,000$ (micro-cents) and executed exclusively using integer operations (BigInt in TypeScript, i128 in Rust).
  2. Remainder Conservation: For any division $P / N$, both the quotient $Q$ and remainder $R$ are preserved: $$P = (N \times Q) + R$$
  3. Terminal Period Absorption: The discrete integer remainder is deterministically absorbed into the terminal period of the performance obligation.
// DETERMINISTIC 128-BIT SCALED ARITHMETIC ($0.00 DRIFT)
export function calculateZeroDriftWaterfall(totalMicroCents: bigint, periods: bigint): bigint[] {
  const basePeriod = totalMicroCents / periods;
  const remainder = totalMicroCents % periods;

  const schedule: bigint[] = [];
  for (let i = 0n; i < periods; i++) {
    if (i === periods - 1n) {
      // Final period absorbs exact micro-cent remainder
      schedule.push(basePeriod + remainder);
    } else {
      schedule.push(basePeriod);
    }
  }
  return schedule;
}
Enter fullscreen mode Exit fullscreen mode

Result: Strict $0.000000 Variance

  • Sum of recognized periods + remaining deferred revenue always equals 100.000000% of contract transaction price.
  • Merkle-tree cryptographic workpapers prove to external auditors that schedules have not suffered rounding drift or post-close alterations.

Originally published on the Soluqube Engineering Architecture Blog.

Top comments (0)