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.
-
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/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 dwg/objects-write.js:658 in insertScale 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/objects-write.js:658 in insertScale 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/objects-write.js:658 in insertScale 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/objects-write.js:660 in insertScale 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 dwg/objects-write.js:774 DetailCraft, PartCraft
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. Not in the register. -
Against 1 dwg/objects-write.js:818 DetailCraft, PartCraft
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. 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 bodies-ui.js:225 in panel PartCraft
grid.push(host.check(t('ui.bodies.scale.uniform'), f.uniform, (v) => set(f, t('ui.bodies.undo.uniform'), (g) => { g.uniform = v; if (!v && g.sx === 1 && g.sy === 1 && g.sz === 1) { g.sx = g.s; g.sy ==== in
g.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 bodies-ui.js:225 in panel PartCraft
grid.push(host.check(t('ui.bodies.scale.uniform'), f.uniform, (v) => set(f, t('ui.bodies.undo.uniform'), (g) => { g.uniform = v; if (!v && g.sx === 1 && g.sy === 1 && g.sz === 1) { g.sx = g.s; g.sy ==== in
g.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 bodies-ui.js:225 in panel PartCraft
grid.push(host.check(t('ui.bodies.scale.uniform'), f.uniform, (v) => set(f, t('ui.bodies.undo.uniform'), (g) => { g.uniform = v; if (!v && g.sx === 1 && g.sy === 1 && g.sz === 1) { g.sx = g.s; g.sy ==== in
g.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 flow-study.js:82 in readFlow PartCraft
if (typeof raw !== 'object' || Array.isArray(raw) || raw.v !== 1) bad(t('study.flow.err.bad_study'));!== in
raw.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Flow study: fluid cells, openings and wall distances, Flow study: 32-bit steps in the mesh and the result fields. -
Against 1 sim.js:80 in readSimStudy PartCraft
if (!raw || typeof raw !== 'object' || Array.isArray(raw) || raw.v !== 1) bad(t('study.sim.err.bad_study'));!== in
raw.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Study set-up: element size and the mesh handed to the solver. -
Against 1 sim.js:97 in readGenStudy PartCraft
if (!raw || typeof raw !== 'object' || Array.isArray(raw) || raw.v !== 1) bad(t('study.sim.err.bad_gen'));!== in
raw.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Study set-up: element size and the mesh handed to the solver. -
Against 1 swmacro.js:1569 in partToSwb PartCraft
if (info.factor !== 1) rhs = `(${rhs}) * ${formatNumber(info.factor)}`;!== in
info.factor !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Numbers written into the VBA macro export.