Resources Numerical accuracy Calculation policy

Pass or fail against a regulation limit

Decides whether a found value meets the minimum, maximum or range of a regulation rule.

How the precision is kept

The comparison is 64-bit with an absolute tolerance chosen by the rule unit, so the result depends on that stated tolerance rather than on an exact comparison.

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.

addons/regs/lib/rows.js CadCraft 0.8.2 64-bit 1 calculation Reviewed

Tests None found by the review

Meets the limit

64-bit

True, false or null for a found value against a rule.

min − e ≤ found ≤ max + e

Both bounds are widened by the same absolute tolerance for the unit before comparing, so a value that misses a limit by less than the tolerance passes. Null is returned for a missing or non-finite value instead of a verdict.

  • addons/regs/lib/rows.js
  • lines 13 to 18
  • CadCraft 0.8.2
export const EPS = { mm: 1e-6, pct: 1e-9, m2: 1e-9, r: 1e-6, u: 1e-9, ratio: 1e-9 };

export function judge(rule, found) {
  if (found === null || !Number.isFinite(found)) return null;
  const { min, max } = ruleBounds(rule), e = EPS[rule.unit] || 0;
  return (min === null || found >= min - e) && (max === null || found <= max + e);

In detail

Method
found >= min − e and found <= max + e, where e is the tolerance for the rule unit.
Number types
64-bit numbers.
Tolerances
Absolute, in the rule unit: mm 1e-6, pct 1e-9, m2 1e-9, r 1e-6, u 1e-9, ratio 1e-9; any other unit uses 0. A value that is not finite gives null (not worked out).
Limits
The tolerance is not scaled to the size of the limit.

Approach: 64-bit, stated limit

The arithmetic is 64-bit, but the method or the data sets the accuracy: a solver tolerance, a mesh, a step size, a datum shift, a table. The limit is stated where the result is shown.

Every policy that takes this approach