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 m3d/unit-table.js:126 in convert CadCraft
if (a === b || a.factor === b.factor) return v;=== in
a.factor === b.factor. 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 macro.js:46 in call CadCraft
if (name === '=') return Number(args[0]) === Number(args[1]) ? '1' : '0';=== in
Number(args[0]) === Number(args[1]). 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 pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[0].x === c[1].x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[1].y === c[2].y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[2].x === c[3].x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[3].y === c[0].y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[0].y === c[1].y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[1].x === c[2].x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[2].y === c[3].y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values pdfmodel.js:136 in isAxisRect CadCraft
const isAxisRect = (c) => c.length === 4 && ((c[0].x === c[1].x && c[1].y === c[2].y && c[2].x === c[3].x && c[3].y === c[0].y) || (c[0].y === c[1].y && c[1].x === c[2].x && c[2].y === c[3].y && c[3].=== in
c[3].x === c[0].x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: PDF underlay placement and PDF import. -
Two computed values redline.js:80 in frameOf CadCraft
if (!validBounds(b) || b.maxX === b.minX || b.maxY === b.minY) return null;=== in
b.maxX === b.minX. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Redline items placed in the drawing. -
Two computed values redline.js:80 in frameOf CadCraft
if (!validBounds(b) || b.maxX === b.minX || b.maxY === b.minY) return null;=== in
b.maxY === b.minY. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Redline items placed in the drawing. -
Two computed values sketch.js:143 in cleanStroke CadCraft
const sq = ang !== Math.atan2(last.y - first.y, last.x - first.x);!== in
ang !== Math.atan2(last.y - first.y, last.x - first.x). Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Pen sketch cleanup. -
Two computed values unit-table.js:126 in convert CadCraft, BimCraft, ModelCraft, MarkupCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (a === b || a.factor === b.factor) return v;=== in
a.factor === b.factor. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Unit conversion, Unit table: reading and writing values. -
Two computed values usd/earcut.js:162 in findHoleBridge CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, 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. Reviewed: Polygon triangulation (ear clipping). -
Two computed values usd/earcut.js:180 in findHoleBridge CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, 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. Reviewed: Polygon triangulation (ear clipping). -
Two computed values usd/earcut.js:195 in getLeftmost CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, 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. Reviewed: Polygon triangulation (ear clipping). -
Two computed values usd/earcut.js:218 in equals CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, 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. Reviewed: Polygon triangulation (ear clipping). -
Two computed values usd/earcut.js:218 in equals CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, 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. Reviewed: Polygon triangulation (ear clipping). -
Two computed values usd/earcut.js:248 in middleInside CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, 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. Reviewed: Polygon triangulation (ear clipping). -
Two computed values usd/geom.js:92 in valueAt CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
if (!a || !b || a.t !== b.t || typeof a.v === 'string' || a.t.startsWith('quat') || a.t.includes('token') || a.t === 'bool') return a;!== in
a.t !== b.t. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: USD transforms and placement, USD mesh coordinates in saved and exported files. -
Two computed values view.js:363 in syncEntered CadCraft
if (b.cx !== vp.cx || b.cy !== vp.cy || b.s !== vp.s || b.tw !== (vp.tw || 0)) {!== in
b.cx !== vp.cx. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Picked points, object snaps and viewport views, 2D drawing on screen. -
Two computed values view.js:363 in syncEntered CadCraft
if (b.cx !== vp.cx || b.cy !== vp.cy || b.s !== vp.s || b.tw !== (vp.tw || 0)) {!== in
b.cy !== vp.cy. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Picked points, object snaps and viewport views, 2D drawing on screen. -
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. -
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 dxf-model.js:58 in msg CadCraft, BimCraft, TakeoffCraft, CivilCraft
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. Reviewed: DXF reading into the shared drawing model. -
Against 1 dxf.js:177 in readHeader CadCraft
else if (varName === '$LTSCALE' && c === 40 && parseFloat(v) > 0 && parseFloat(v) !== 1) out.meta.ltscale = parseFloat(v);!== in
parseFloat(v) !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: DXF reading: objects from the file's text, DXF writing: numbers as text.