Resources Numerical accuracy Calculation policy

Spread between coarse and refined results

States how far a coarse live result is from the refined one, as a fraction.

How the precision is kept

One relative difference per number that the coarse and refined results share, computed in 64-bit and skipped when it cannot be formed.

Calculations under this policy

1 calculation in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.

study/live.js CadCraft 0.8.2 64-bit 1 calculation Reviewed

Tests tools/live-test/live.mjs

Relative difference

64-bit

The fraction by which a coarse result differs from the refined result.

|a − b| ÷ |b|

Divides by |refined| and skips zero and non-finite values, so there is no division by zero. The worst value is a plain maximum.

  • study/live.js
  • lines 94 to 108
  • CadCraft 0.8.2
/**
 * How far a coarse answer may be from the refined one. Used by the tests and the panel's note: the fraction |coarse − refined| / |refined|
 * for each number the two results share, and the worst of them.
 */
export function spread(coarse, refined, keys) {
  const out = {};
  let worst = 0;
  for (const k of keys) {
    const a = coarse[k], b = refined[k];
    if (!Number.isFinite(a) || !Number.isFinite(b) || b === 0) continue;
    out[k] = Math.abs(a - b) / Math.abs(b);
    if (out[k] > worst) worst = out[k];
  }
  return { by: out, worst };
}

In detail

Method
|coarse − refined| ÷ |refined| for each key, and the largest of them.
Number types
64-bit numbers.
Tolerances
None; a key is skipped when either value is not finite or the refined value is 0.

Approach: 64-bit, direct

Every value is a 64-bit number from input to result. Formulas are closed form or a direct solve, and every comparison uses a stated tolerance.

Every policy that takes this approach