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/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/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 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 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 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 libitem.js:233 in msg CadCraft, BimCraft
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: Library item geometry from blocks, meshes and tables, Lengths and units for Library items. -
Against 1 libitem.js:1465 in drawingUnits CadCraft, BimCraft
const metric = Number(db.header?.MEASUREMENT) === 1;=== in
Number(db.header?.MEASUREMENT) === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Library item geometry from blocks, meshes and tables, Lengths and units for Library items. -
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 process/env/cheminfo.js:182 in groupsOf CadCraft, BimCraft
if (arom) inc(a.h === 1 ? 'ring =CH-' : a.h === 0 ? 'ring =C<' : 'ring =CH-');=== in
a.h === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Molar mass and group-contribution estimates. -
Against 1 process/env/cheminfo.js:184 in groupsOf CadCraft, BimCraft
else if (dbl) { if (nb[i].some((x) => x.order === 2 && mol.atoms[x.o].el !== 'C')) missing.push('carbonyl or C=X carbon'); else if (inRing[i]) missing.push('ring alkene carbon'); else if (dbl === 1 &&=== in
a.h === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Molar mass and group-contribution estimates. -
Against 1 process/env/cheminfo.js:185 in groupsOf CadCraft, BimCraft
else if (inRing[i]) { if (a.h === 2) inc('ring CH2'); else if (a.h === 1) inc('ring CH'); else missing.push('ring quaternary carbon'); }=== in
a.h === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Molar mass and group-contribution estimates. -
Against 1 process/env/cheminfo.js:188 in groupsOf CadCraft, BimCraft
if (a.h === 1 && nb[i].length === 1 && !mol.atoms[nb[i][0].o].aromatic) inc('-OH (alcohol)');=== in
a.h === 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Molar mass and group-contribution estimates. -
Against 1 process/env/molsketch.js:85 in symbol CadCraft, BimCraft
return '[' + el + (a.h ? (a.h === 1 ? 'H' : 'H' + a.h) : '') + (q ? (q > 0 ? '+' + (q > 1 ? q : '') : '-' + (q < -1 ? -q : '')) : '') + ']';=== in
a.h === 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 process/live.js:37 in readPacket CadCraft, BimCraft
if (!raw || typeof raw !== 'object' || raw.format !== FORMAT || raw.v !== 1) return null;!== 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. Not in the register. -
Against 1 process/safety/hazoptimer.js:57 in restore CadCraft, BimCraft
if (!s || s.v !== 1 || !Array.isArray(s.rows)) return false;!== in
s.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.