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.

  • 316 comparisons to look at
  • 149 files
  • 175 likely to matter (against a decimal, or two computed values)
  • Scanned

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 render/anim.js:467 in moveKeys BimCraft, ModelCraft
    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. Reviewed: Animation keys, curves and poses.

  • Two computed values res-elec.js:238 in changeDevice BimCraft
    if (nx.height !== d.height) writeDevice(w, nx, readWalls(w, d.storey));

    !== in nx.height !== d.height. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Electrical devices: positions, loads and circuit amps.

  • Two computed values res-ui.js:170 in bindRows BimCraft
    if (e.target.value === 'spiral' && R.stair.width === STAIR_DEFAULTS.width) R.stair.width = SPIRAL_DEFAULTS.width;

    === in R.stair.width === STAIR_DEFAULTS.width. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Ground read from a survey file, Figures shown in the residential panels and schedules.

  • Two computed values res-ui.js:171 in bindRows BimCraft
    else if (e.target.value !== 'spiral' && R.stair.width === SPIRAL_DEFAULTS.width) R.stair.width = STAIR_DEFAULTS.width;

    === in R.stair.width === SPIRAL_DEFAULTS.width. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Ground read from a survey file, Figures shown in the residential panels and schedules.

  • Two computed values views-ui.js:235 in editCallout BimCraft
    scale.value = scalesFor(u).some((x) => x.ratio === c.scale) ? String(c.scale) : '0';

    === in x.ratio === c.scale. 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 views-ui.js:348 in rangeFields BimCraft
    scale.value = scalesFor(u).some((x) => x.ratio === vals.scale) ? String(vals.scale) : '0';

    === in x.ratio === vals.scale. 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 wall-section-graphics.js:165 in cutFaceItems BimCraft
    const graphic = c.layers && c.detail==='fine' && scale!==c.scale ? {...c,layers:c.layers.map(l=>({...l,hatch:['diagonal','crosshatch'].includes(l.fill)?l.polys.flatMap(p=>hatchSegments(p,[],l.fill==='

    !== in scale!==c.scale. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Wall layers drawn in plans and sections.

  • Two computed values addons/cabinet/lib/cutlist/cutlist.js:86 in sameKind CadCraft
    const sameKind = (a, b) => a.material === b.material && a.thickness === b.thickness && a.length === b.length && a.width === b.width &&

    === in a.thickness === b.thickness. 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 addons/cabinet/lib/cutlist/cutlist.js:86 in sameKind CadCraft
    const sameKind = (a, b) => a.material === b.material && a.thickness === b.thickness && a.length === b.length && a.width === b.width &&

    === in a.width === b.width. 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 addons/cabinet/lib/draw.js:29 in planEnts CadCraft
    for (const f of frontsOf(cab, R).filter((g, i, a) => a.findIndex((h) => h.x === g.x) === i)) out.push(rect(f.x * k, D, f.w * k, F));

    === in h.x === g.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 addons/cabinet/main.js:419 in renderPanel CadCraft
    if (cabs.length) facts = t('panel.facts', { n: cabs.length, pieces: cutList(partsOf(cabs.filter((x) => x.d.u === cabs[0].d.u))).pieces });

    === in x.d.u === cabs[0].d.u. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cabinets along a wall line.

  • Two computed values addons/cabinetcraft/lib/cutlist/cutlist.js:86 in sameKind CadCraft, BimCraft, ModelCraft, PartCraft
    const sameKind = (a, b) => a.material === b.material && a.thickness === b.thickness && a.length === b.length && a.width === b.width &&

    === in a.thickness === b.thickness. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cut list sizes, areas and banding lengths.

  • Two computed values addons/cabinetcraft/lib/cutlist/cutlist.js:86 in sameKind CadCraft, BimCraft, ModelCraft, PartCraft
    const sameKind = (a, b) => a.material === b.material && a.thickness === b.thickness && a.length === b.length && a.width === b.width &&

    === in a.width === b.width. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cut list sizes, areas and banding lengths.

  • Two computed values addons/cabinetcraft/lib/draw.js:29 in planEnts CadCraft, BimCraft, ModelCraft, PartCraft
    for (const f of frontsOf(cab, R).filter((g, i, a) => a.findIndex((h) => h.x === g.x) === i)) out.push(rect(f.x * k, D, f.w * k, F));

    === in h.x === g.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cabinet plan, elevation, section and 3D boxes.

  • Two computed values addons/cabinetcraft/lib/estimate.js:140 in sheetsFor CadCraft, BimCraft, ModelCraft, PartCraft
    const m = nestJob && nestJob.mats.find((x) => x.material === g.material && x.thickness === g.thickness);

    === in x.thickness === g.thickness. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cabinet job cost estimate.

  • Two computed values addons/lighting/lib/reports.js:84 in checks CadCraft
    for (let i = 0; i < spans.length; i++) for (let j = i + 1; j < spans.length && spans[j].u === spans[i].u && spans[j].from <= spans[i].to; j++) {

    === in spans[j].u === spans[i].u. 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 addons/windows/lib/cutlist/cutlist.js:86 in sameKind CadCraft
    const sameKind = (a, b) => a.material === b.material && a.thickness === b.thickness && a.length === b.length && a.width === b.width &&

    === in a.thickness === b.thickness. 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 addons/windows/lib/cutlist/cutlist.js:86 in sameKind CadCraft
    const sameKind = (a, b) => a.material === b.material && a.thickness === b.thickness && a.length === b.length && a.width === b.width &&

    === in a.width === b.width. 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 cadcraft.js:506 in rememberView CadCraft
    if (top && top.cx === v.cx && top.cy === v.cy && top.zoom === v.zoom) return;

    === in top.cx === v.cx. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cursor point and status readouts.

  • Two computed values cadcraft.js:506 in rememberView CadCraft
    if (top && top.cx === v.cx && top.cy === v.cy && top.zoom === v.zoom) return;

    === in top.cy === v.cy. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cursor point and status readouts.

  • Two computed values cadcraft.js:967 in withNextGhost CadCraft
    if (!was || was.x !== n.x || was.y !== n.y) accessUi?.say(t('access.ghost.next', { what: t('auto.kind.' + n.kind), at: fmtL(n.x) + ', ' + fmtL(n.y) }));   // EG.52: a ghost is said once when it appear

    !== in was.x !== n.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cursor point and status readouts.

  • Two computed values cadcraft.js:967 in withNextGhost CadCraft
    if (!was || was.x !== n.x || was.y !== n.y) accessUi?.say(t('access.ghost.next', { what: t('auto.kind.' + n.kind), at: fmtL(n.x) + ', ' + fmtL(n.y) }));   // EG.52: a ghost is said once when it appear

    !== in was.y !== n.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Cursor point and status readouts.

  • Two computed values dwg/objects-write.js:659 in insertScale CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
    else if (sx === sy && sx === sz) { w.BB(2); w.RD(sx); }

    === in sx === sy. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: DWG object values written and read.

  • Two computed values dwg/objects-write.js:659 in insertScale CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft
    else if (sx === sy && sx === sz) { w.BB(2); w.RD(sx); }

    === in sx === sz. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: DWG object values written and read.

  • Two computed values dwg/table-write.js:71 in insertScale CadCraft, ModelCraft, CivilCraft, DetailCraft, PartCraft
    else if (sx === sy && sx === sz) { w.BB(2); w.RD(sx); }

    === in sx === sy. 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 dwg/table-write.js:71 in insertScale CadCraft, ModelCraft, CivilCraft, DetailCraft, PartCraft
    else if (sx === sy && sx === sz) { w.BB(2); w.RD(sx); }

    === in sx === sz. 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 gds.js:133 in gdsEntities CadCraft
    if (it.k === 'boundary') { if (pts.length > 1 && pts[0].x === pts[pts.length - 1].x && pts[0].y === pts[pts.length - 1].y) pts.pop(); if (pts.length >= 3) ents.push({ type: 'poly', layer: lname, color

    === in pts[0].x === pts[pts.length - 1].x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: GDSII layout read and placement.

  • Two computed values gds.js:133 in gdsEntities CadCraft
    if (it.k === 'boundary') { if (pts.length > 1 && pts[0].x === pts[pts.length - 1].x && pts[0].y === pts[pts.length - 1].y) pts.pop(); if (pts.length >= 3) ents.push({ type: 'poly', layer: lname, color

    === in pts[0].y === pts[pts.length - 1].y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: GDSII layout read and placement.

  • Two computed values libitem.js:1715 in emit CadCraft, BimCraft
    if (c4 && (c4.x !== c3.x || c4.y !== c3.y || (c4.z || 0) !== (c3.z || 0))) faces.push(q[0], q[2], q[3]);

    !== in c4.x !== c3.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Library item geometry from blocks, meshes and tables, Lengths and units for Library items.

  • Two computed values libitem.js:1715 in emit CadCraft, BimCraft
    if (c4 && (c4.x !== c3.x || c4.y !== c3.y || (c4.z || 0) !== (c3.z || 0))) faces.push(q[0], q[2], q[3]);

    !== in c4.y !== c3.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Library item geometry from blocks, meshes and tables, Lengths and units for Library items.

  • Two computed values libitem.js:1715 in emit CadCraft, BimCraft
    if (c4 && (c4.x !== c3.x || c4.y !== c3.y || (c4.z || 0) !== (c3.z || 0))) faces.push(q[0], q[2], q[3]);

    !== in (c4.z || 0) !== (c3.z || 0). Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Library item geometry from blocks, meshes and tables, Lengths and units for Library items.

  • Two computed values m3d/earcut.js:161 in findHoleBridge CadCraft, TakeoffCraft
    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: Triangulation of faces with holes.

  • Two computed values m3d/earcut.js:179 in findHoleBridge CadCraft, TakeoffCraft
    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: Triangulation of faces with holes.

  • Two computed values m3d/earcut.js:194 in getLeftmost CadCraft, TakeoffCraft
    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: Triangulation of faces with holes.

  • Two computed values m3d/earcut.js:217 in equals CadCraft, TakeoffCraft
    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: Triangulation of faces with holes.

  • Two computed values m3d/earcut.js:217 in equals CadCraft, TakeoffCraft
    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: Triangulation of faces with holes.

  • Two computed values m3d/earcut.js:247 in middleInside CadCraft, TakeoffCraft
    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: Triangulation of faces with holes.

  • Two computed values m3d/model.js:137 in meshGeometry CadCraft
    if (g && g.v === mesh.v && !mesh.recording) return g.def;

    === in g.v === mesh.v. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Face planes, areas, triangles and solid volume, Drawing an edge: welding, splitting and re-facing, Push/pull, move, stretch, follow me and intersect, Arcs, circles, smooth curves, divide and offset, Dimensions and typed sizes in 3D, Groups, placements and the model file, Welding of imported geometry, Smooth shading and texture placement.

  • Two computed values m3d/model.js:538 in addEdge CadCraft
    if (stops[i].v === stops[i + 1].v) continue;

    === in stops[i].v === stops[i + 1].v. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Face planes, areas, triangles and solid volume, Drawing an edge: welding, splitting and re-facing, Push/pull, move, stretch, follow me and intersect, Arcs, circles, smooth curves, divide and offset, Dimensions and typed sizes in 3D, Groups, placements and the model file, Welding of imported geometry, Smooth shading and texture placement.

  • Two computed values m3d/tools.js:1060 in down CadCraft
    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. Reviewed: 3D drawing and editing tools.

  • 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.