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 0 wall-assemblies-ui.js:54 in totals BimCraft
membraneNote.hidden=!recipe.layers.some(l=>l.t===0);=== in
l.t===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 wall-assemblies-ui.js:81 in draw BimCraft
const useDefault=button(mt('useDefault'),()=>{const m=materials.find(m=>m.id===layer.materialId);if(m){layer.t=m.defaultThickness;if(layer.t===0)layer.function='membrane';draw();}},{disabled:layer.kin=== in
layer.t===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 wall-plan-graphics.js:106 in wallPlanGraphics BimCraft
const polys = layer.t === 0 ? [] : pieces.map(p => clip(clip(p, 1, Math.min(off, end), 1), 1, Math.max(off, end), -1)).filter(p => p.length >= 3).map(p => mappedPath(p, map, true));=== in
layer.t === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Wall layers drawn in plans and sections. -
Against 0 wall-plan-graphics.js:111 in wallPlanGraphics BimCraft
if (layer.t === 0) boundaries.set(off, { offset: off, membrane: true, color: material.fillColor });=== in
layer.t === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Wall layers drawn in plans and sections. -
Against 0 wall-section-graphics.js:139 in wallSectionGraphics BimCraft
if(l.t===0)boundaries.set(off,{offset:c+off*lateral,membrane:true,color:mat.fillColor});=== in
l.t===0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Wall layers drawn in plans and sections. -
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 pointcloud.js:721 in scanPtx CadCraft, BimCraft
if (px === 0 && py === 0 && pz === 0) { missing++; return; }=== in
px === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Point cloud positions and read-in values. -
Against 0 pointcloud.js:721 in scanPtx CadCraft, BimCraft
if (px === 0 && py === 0 && pz === 0) { missing++; return; }=== in
py === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Point cloud positions and read-in values. -
Against 0 pointcloud.js:721 in scanPtx CadCraft, BimCraft
if (px === 0 && py === 0 && pz === 0) { missing++; return; }=== in
pz === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Point cloud positions and read-in values. -
Against 0 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 === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Molar mass and group-contribution estimates. -
Against 0 process/env/cheminfo.js:189 in groupsOf CadCraft, BimCraft
else if (a.h === 0 && nb[i].length === 2 && !inRing[i] && nb[i].every((x) => x.order === 1 && !mol.atoms[x.o].aromatic)) inc('-O- (non-ring)');=== in
a.h === 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Molar mass and group-contribution estimates. -
Against 0 process/equip/pipestress.js:109 in buildModel CadCraft, BimCraft
const W = { id: 'W', name: 'Weight', kind: 'dead', selfWeight: 1, loads: fm.members.map((e) => ({ type: 'udl', member: e.id, dir: 'Z', w: -(wContents + wIns) })).filter((l) => l.w !== 0) };!== in
l.w !== 0. Usually fine as a guard against dividing by zero; check it is not meant to catch a near-zero value too. Reviewed: Pipe stress checks. -
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 wheel-pad.js:20 in isSwipe CadCraft, BimCraft, MarkupCraft, TakeoffCraft, CivilCraft
const step = dx === 0 && ((Number.isFinite(e.wheelDeltaY) && e.wheelDeltaY !== 0 && e.wheelDeltaY % 120 === 0) || (Number.isInteger(dy) && Math.abs(dy) >= 50));=== in
dx === 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 wheel-pad.js:22 in isSwipe CadCraft, BimCraft, MarkupCraft, TakeoffCraft, CivilCraft
if (dx !== 0 || !Number.isInteger(dy) || Math.abs(dy) < 50) { this.until = t + 400; return true; }!== in
dx !== 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.