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 modelcraft.js:918 in init ModelCraft
if (c.x !== pinch.c.x || c.y !== pinch.c.y) cam[move](c.x - pinch.c.x, c.y - pinch.c.y, pinch.pivot);!== in
c.y !== pinch.c.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Entity info: volume, size, angle and area, Edits and settings from the main window. -
Two computed values modelcraft.js:1223 in openCtxMenu ModelCraft
if (s && !host.sel.some((x) => x.t === s.t && x.id === s.id)) host.setSel([s]);=== in
x.t === s.t. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Entity info: volume, size, angle and area, Edits and settings from the main window. -
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. -
Two computed values 3dm/earcut.js:162 in findHoleBridge PartCraft
if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {!== in
p.next.y !== p.y. 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 3dm/earcut.js:180 in findHoleBridge PartCraft
if (locallyInside(p, hole) && (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {=== in
p.x === m.x. 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 3dm/earcut.js:195 in getLeftmost PartCraft
if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;=== in
p.x === leftmost.x. 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 3dm/earcut.js:218 in equals PartCraft
const equals = (p1, p2) => p1.x === p2.x && p1.y === p2.y;=== in
p1.x === p2.x. 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 3dm/earcut.js:218 in equals PartCraft
const equals = (p1, p2) => p1.x === p2.x && p1.y === p2.y;=== in
p1.y === p2.y. 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 3dm/earcut.js:248 in middleInside PartCraft
if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) inside = !inside;!== in
p.next.y !== p.y. 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 contact.js:159 in pairAll PartCraft
if (!old || old.t !== best.t || Math.abs(old.L1 - best.L1) > 2e-3 || Math.abs(old.L2 - best.L2) > 2e-3) moved = true;!== in
old.t !== best.t. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Contact between parts in stress analysis. -
Two computed values illustrate/anim.js:129 in sortKeys PartCraft
for (const k of keys) { if (out.length && out[out.length - 1].t === k.t) out[out.length - 1] = k; else out.push(k); }=== in
out[out.length - 1].t === k.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 illustrate/anim.js:467 in moveKeys PartCraft
for (const k of x.keys) { const last = out[out.length - 1]; if (last && last.t === k.t) { if (moved.has(k) || !moved.has(last)) out[out.length - 1] = k; } else out.push(k); }=== in
last.t === k.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 assets/js/engines/des/engine.js:34 in less Shared shell, every app
const less = (x, y) => x.t < y.t || (x.t === y.t && (x.pr < y.pr || (x.pr === y.pr && x.seq < y.seq)));=== in
x.t === y.t. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Flow simulation (discrete events). -
Two computed values assets/js/engines/pcb/place.js:33 in place Shared shell, every app
const stuck = free.length > 1 && free.every((p) => p.x === free[0].x && p.y === free[0].y);=== in
p.x === free[0].x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Board placement and routing. -
Two computed values assets/js/engines/pcb/place.js:33 in place Shared shell, every app
const stuck = free.length > 1 && free.every((p) => p.x === free[0].x && p.y === free[0].y);=== in
p.y === free[0].y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Board placement and routing. -
Two computed values fixedqty.js:76 in importQuantities TakeoffCraft
if (old.qty === q.qty && old.unit === q.unit) { out.same++; continue; }=== in
old.qty === q.qty. 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 model.js:641 in setMarksArea TakeoffCraft
if (!set.has(m.id) || (m.area || null) === (area || null)) continue;=== in
(m.area || null) === (area || null). Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Takeoff quantities from marks, Priced estimate. -
Two computed values model.js:934 in quantities TakeoffCraft
if (area !== undefined && (m.area || null) !== area) continue; // one bid area (null: the marks in none)!== in
(m.area || null) !== area. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Takeoff quantities from marks, Priced estimate. -
Against a whole number people-sim.js:142 in field BimCraft
if (Math.abs(di) + Math.abs(dj) === 2 && (!free[cj * nx + i] || !free[j * nx + ci])) continue; // no cutting a corner=== in
Math.abs(di) + Math.abs(dj) === 2. Check that the value is exact by construction; if not, compare within an epsilon. Reviewed: People movement and travel distance. -
Against a whole number people-sim.js:143 in field BimCraft
if (Math.abs(di) === 2 && (!free[cj * nx + ci + di / 2] || !free[j * nx + ci + di / 2])) continue; // knight move: both middle cells free=== in
Math.abs(di) === 2. Check that the value is exact by construction; if not, compare within an epsilon. Reviewed: People movement and travel distance. -
Against a whole number people-sim.js:144 in field BimCraft
if (Math.abs(dj) === 2 && (!free[(cj + dj / 2) * nx + ci] || !free[(cj + dj / 2) * nx + i])) continue;=== in
Math.abs(dj) === 2. Check that the value is exact by construction; if not, compare within an epsilon. Reviewed: People movement and travel distance. -
Against 1 addons/plant/lib/core.js:12 in lookupFrom BimCraft
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/sprinkler/lib/core.js:12 in lookupFrom BimCraft
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 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/apparel/lib/text.js:24 in lookupFrom CadCraft
if (s && typeof s === 'object') s = (vars.n !== undefined && s['=' + vars.n]) || (Number(vars.n) === 1 && s.one) || s.other || key; // plurals (English rules)=== 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/cabinet/lib/core.js:17 in lookupFrom CadCraft
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/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/harness/lib/core.js:17 in lookupFrom CadCraft
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/hvac/lib/mep-core.js:29 in lookupFrom CadCraft
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/lighting/lib/core.js:17 in lookupFrom CadCraft
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/objects.js:98 in identity CadCraft
const identity = (e) => !(e.x || e.y || e.rot) && (e.sx ?? 1) === 1 && (e.sy ?? 1) === 1;=== in
(e.sx ?? 1) === 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/objects.js:98 in identity CadCraft
const identity = (e) => !(e.x || e.y || e.rot) && (e.sx ?? 1) === 1 && (e.sy ?? 1) === 1;=== in
(e.sy ?? 1) === 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/pid/lib/core.js:23 in lookupFrom CadCraft
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. Reviewed: P&ID line geometry and connections. -
Against 1 addons/piping/lib/mep-core.js:29 in lookupFrom CadCraft
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. Reviewed: Pipe runs: layout, 3D solid and schedule. -
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 addons/windows/lib/core.js:17 in lookupFrom CadCraft
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 areaclip.js:75 in cleanAreaClip CadCraft, BimCraft, MarkupCraft, DetailCraft
if (!d || typeof d !== 'object' || d.format !== AREA_FORMAT || d.v !== 1) return null;!== in
d.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Size of a copied area. -
Against 1 commands.js:3332 in insertFromFile CadCraft
return { name: r.name, scale: plan.scale !== 1 ? plan.scale : null };!== in
plan.scale !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Typed points, distances and angles, Shapes made by the draw commands, Move, rotate, scale, mirror, array, stretch and lengthen, Distance, area, angle and point inquiries, Where dimensions are attached, User coordinate system set by command, Viewports on a sheet. -
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.