Resources Numerical accuracy
Equality comparisons
Where the code asks whether two decimal numbers are exactly equal. A floating-point result can differ from another in the last digit after a few transformations, so a mesh run through several of them can change the length of an edge, or miss a match. Compare with < or > where a range is meant, and with a documented epsilon where equality is.
Equality comparisons
These are places worth checking, not confirmed bugs. The scan reads how the code is written, not what it is meant to do, so some entries are fine as they are: a test against exactly 0 is often a deliberate guard against dividing by zero. It skips text, counts and indexes, and any comparison it cannot be sure involves decimal numbers, so there are likely more in the code than are listed here.
-
Two computed values nurbs/trim.js:163 in sameXY ModelCraft, PartCraft
const sameXY = (a, b) => a.x === b.x && a.y === b.y;=== in
a.x === b.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Trimmed surfaces: loops, cut tessellation and area. -
Two computed values nurbs/trim.js:163 in sameXY ModelCraft, PartCraft
const sameXY = (a, b) => a.x === b.x && a.y === b.y;=== in
a.y === b.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Trimmed surfaces: loops, cut tessellation and area. -
Two computed values nurbs/trim.js:209 in triangulate ModelCraft, PartCraft
if ((a.y > M.y) === (b.y > M.y) && !(a.y === M.y || b.y === M.y)) continue;=== in
a.y === M.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Trimmed surfaces: loops, cut tessellation and area. -
Two computed values nurbs/trim.js:209 in triangulate ModelCraft, PartCraft
if ((a.y > M.y) === (b.y > M.y) && !(a.y === M.y || b.y === M.y)) continue;=== in
b.y === M.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Trimmed surfaces: loops, cut tessellation and area. -
Two computed values nurbs/trim.js:210 in triangulate ModelCraft, PartCraft
if (a.y === b.y) continue;=== in
a.y === b.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Trimmed surfaces: loops, cut tessellation and area. -
Two computed values timeline.js:305 in refresh ModelCraft
picked = picked.filter((p) => keysOf(p.track).some((k) => k.t === p.t));=== in
k.t === p.t. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Not in the register. -
Two computed values timeline.js:337 in keyOf ModelCraft
return ks && ks.find((x) => x.t === p.t);=== in
x.t === p.t. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Not in the register. -
Two computed values tools.js:1060 in down ModelCraft
const inSel = this.h.sel.some((x) => x.t === s.t && x.id === s.id);=== in
x.t === s.t. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Not in the register. -
Against 1 render/pt-ggx.js:55 in modulatedEta BimCraft, ModelCraft
if (weight === 1) return eta;=== in
weight === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Path tracer kernels. -
Against 1 site-context.js:59 in cleanContext BimCraft, ModelCraft, CivilCraft
if (!o || typeof o !== 'object' || o.format !== FORMAT || o.v !== 1) return null;!== in
o.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Site surroundings in local meters. -
Against 1 xr/xr-core.js:179 in cleanPeer BimCraft, ModelCraft
if (!x || typeof x !== 'object' || x.v !== 1 || !isPose(x.h)) return null;!== in
x.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Headset review: measuring, section cuts and issue cameras, AR on site: lining the model up with the building. -
Against 1 addons/cabinetcraft/lib/core.js:17 in lookupFrom CadCraft, BimCraft, ModelCraft, PartCraft
if (s && typeof s === 'object') s = (vars.n !== undefined && s['=' + vars.n]) || (Number(vars.n) === 1 && s.one) || s.other || key;=== in
Number(vars.n) === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 addons/trusscraft/lib/core.js:12 in lookupFrom CadCraft, BimCraft, ModelCraft, PartCraft
if (s && typeof s === 'object') s = (vars.n !== undefined && s['=' + vars.n]) || (Number(vars.n) === 1 && s.one) || s.other || key;=== in
Number(vars.n) === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 dwg/messages.js:188 in msg CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (typeof s === 'object') s = s['=' + fills.n] ?? (Number(fills.n) === 1 ? s.one : s.other) ?? s.other;=== in
Number(fills.n) === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 dwg/objects-write.js:658 in insertScale CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
if (sx === 1 && sy === 1 && sz === 1) w.BB(3);=== in
sx === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: DWG object values written and read. -
Against 1 dwg/objects-write.js:658 in insertScale CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
if (sx === 1 && sy === 1 && sz === 1) w.BB(3);=== in
sy === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: DWG object values written and read. -
Against 1 dwg/objects-write.js:658 in insertScale CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
if (sx === 1 && sy === 1 && sz === 1) w.BB(3);=== in
sz === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: DWG object values written and read. -
Against 1 dwg/objects-write.js:660 in insertScale CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
else if (sx === 1) { w.BB(1); w.DD(sy, 1); w.DD(sz, 1); }=== in
sx === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: DWG object values written and read. -
Against 1 dwg/objects-write.js:774 CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
const weights = ctrl.some((p) => p.w !== undefined && p.w !== 1) || (r.weights || []).some((x) => x !== 1);!== in
p.w !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: DWG object values written and read. -
Against 1 dwg/objects-write.js:818 CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
const rational = ctl.some((p) => p.w !== undefined && p.w !== 1);!== in
p.w !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: DWG object values written and read. -
Against 1 dwg/table-write.js:70 in insertScale CadCraft, ModelCraft, CivilCraft, DetailCraft, PartCraft
if (sx === 1 && sy === 1 && sz === 1) w.BB(3);=== in
sx === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 dwg/table-write.js:70 in insertScale CadCraft, ModelCraft, CivilCraft, DetailCraft, PartCraft
if (sx === 1 && sy === 1 && sz === 1) w.BB(3);=== in
sy === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 dwg/table-write.js:70 in insertScale CadCraft, ModelCraft, CivilCraft, DetailCraft, PartCraft
if (sx === 1 && sy === 1 && sz === 1) w.BB(3);=== in
sz === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 dwg/table-write.js:72 in insertScale CadCraft, ModelCraft, CivilCraft, DetailCraft, PartCraft
else if (sx === 1) { w.BB(1); w.DD(sy, 1); w.DD(sz, 1); }=== in
sx === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 live-crypto.js:329 in verifyAssertion CadCraft, BimCraft, ModelCraft, MarkupCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (!sig || !claims || claims.v !== 1 || typeof claims.name !== 'string') return { ok: false, reason: 'format' };!== in
claims.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 usd/usda-write.js:40 in subLayersText CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
return asset(a) + (o && (o.offset !== 0 || o.scale !== 1) ? ' (' + layerOffsetText(o) + ')' : '');!== in
o.scale !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Number text in USD files. -
Against 1 usd/usda-write.js:47 in layerOffsetText CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (o.scale !== 1) parts.push('scale = ' + num(o.scale, 'f64'));!== in
o.scale !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Number text in USD files. -
Against 1 usd/usda-write.js:172 in listItemText CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (o && (o.offset !== 0 || o.scale !== 1)) parts.push(layerOffsetText(o));!== in
o.scale !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Number text in USD files. -
Against 1 mesh/ops.js:773 in splitByPoints ModelCraft
if (inSplit.has(f) && on.length === 2 && Math.abs(on[0] - on[1]) !== 1 && Math.abs(on[0] - on[1]) !== vs.length - 1) {!== in
Math.abs(on[0] - on[1]) !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Proportional editing weights and edge creases, Inset, bevel and moves along normals, Subdivide, loop cut, bisect, knife and grid fill, Merge, spin, bridge, slide and smooth. -
Against 1 model-info.js:58 in cleanTemplate ModelCraft
if (!v || typeof v !== 'object' || v.v !== 1) return null;!== in
v.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 1 nurbs/step.js:302 in trimOf ModelCraft, PartCraft
let seg = c.deg === 1 ? c.cvs.slice() : Array.from({ length: 33 }, (_, i) => C.point(c, a + (z - a) * i / 32));=== in
c.deg === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: STEP files of NURBS curves and surfaces. -
Against 1 skp/messages.js:160 in msg ModelCraft
if (typeof s === 'object') s = s['=' + fills.n] ?? (Number(fills.n) === 1 ? s.one : s.other) ?? s.other;=== in
Number(fills.n) === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Not in the register. -
Against 0 addons/trusscraft/lib/design.js:130 in designTruss CadCraft, BimCraft, ModelCraft, PartCraft
const closed = g.profile ? g.nodes.find((n) => n.x === 0 && n.z === 0) : true;=== in
n.x === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Truss member forces and timber checks. -
Against 0 addons/trusscraft/lib/design.js:130 in designTruss CadCraft, BimCraft, ModelCraft, PartCraft
const closed = g.profile ? g.nodes.find((n) => n.x === 0 && n.z === 0) : true;=== in
n.z === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Truss member forces and timber checks. -
Against 0 lencalc.js:130 in term CadCraft, ModelCraft, MarkupCraft, TakeoffCraft, CivilCraft, DetailCraft
if (o.t === '/' && b.v === 0) throw new CalcError('divide', o.pos);=== in
b.v === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Arithmetic on typed lengths. -
Against 0 usd/earcut.js:52 in filterPoints CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {=== in
area(p.prev, p, p.next) === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Polygon triangulation (ear clipping). -
Against 0 usd/usda-read.js:476 in component CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (c.k === 'num') { this.i++; return c.v !== 0; }!== in
c.v !== 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Floats read from USD files. -
Against 0 earcut.js:51 in filterPoints ModelCraft
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {=== in
area(p.prev, p, p.next) === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Not in the register. -
Against 0 io/3dm/earcut.js:52 in filterPoints ModelCraft
if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {=== in
area(p.prev, p, p.next) === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Not in the register. -
Against 0 io/3dm/geom.js:155 in rec ModelCraft
if (chordDev(pm, pa, pb) > tol || chordDev(q1, pa, pb) > tol || chordDev(q3, pa, pb) > tol || (depth < 2 && dist(pa, pb) === 0 && dist(pm, pa) > tol)) {=== in
dist(pa, pb) === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: 3DM curves and surfaces: points on them. -
Against 0 io/3dm/tess.js:245 in emit ModelCraft
if (ar === 0) { const n = cross(sub(pos(c), pos(a)), sub(pos(d), pos(a))); if (len(n) === 0) return; }=== in
len(n) === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: 3DM surfaces into triangles. -
Against 0 nurbs/construct.js:86 in revolve ModelCraft, PartCraft
if (V.len(Z) === 0) fail('nurbs.err.axis');=== in
V.len(Z) === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Surfaces from curves: extrude, ruled, revolve and loft, Fitted curves and surfaces: sweeps, networks, Coons patches, offsets, rebuilds and extensions. -
Against 0 tools.js:727 in value ModelCraft
if (!Number.isFinite(deg) || deg === 0) return false;=== in
deg === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Not in the register. -
Against 0 tools.js:1138 in pickPoint ModelCraft
this.k = 1 / Math.max(len(this.T.localDir(this.n)), 1e-9) === 0 ? 1 : len(this.T.localDir(this.n));=== in
1 / Math.max(len(this.T.localDir(this.n)), 1e-9) === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Not in the register.