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.

  • Against a decimal process/env/cheminfo.js:77 in parse CadCraft, BimCraft
    const sum = atoms.map(() => 0); for (const b of bonds) { sum[b.a] += b.order === 1.5 ? 1 : b.order; sum[b.b] += b.order === 1.5 ? 1 : b.order; }

    === in b.order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Molar mass and group-contribution estimates.

  • Against a decimal process/env/cheminfo.js:77 in parse CadCraft, BimCraft
    const sum = atoms.map(() => 0); for (const b of bonds) { sum[b.a] += b.order === 1.5 ? 1 : b.order; sum[b.b] += b.order === 1.5 ? 1 : b.order; }

    === in b.order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Molar mass and group-contribution estimates.

  • Against a decimal process/env/cheminfo.js:126 in toMol CadCraft, BimCraft
    mol.bonds.forEach((b) => L.push(pad(b.a + 1, 3) + pad(b.b + 1, 3) + pad(b.order === 1.5 ? 4 : b.order, 3) + '  0'));

    === in b.order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Molar mass and group-contribution estimates.

  • Against a decimal process/env/cheminfo.js:136 in fromMol CadCraft, BimCraft
    const sum = atoms.map(() => 0); for (const b of bonds) { const o = b.order === 1.5 ? 1 : b.order; sum[b.a] += o; sum[b.b] += o; }

    === in b.order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Molar mass and group-contribution estimates.

  • Against a decimal process/env/cheminfo.js:148 in toSvg CadCraft, BimCraft
    out += b.order === 2 || b.order === 1.5 ? ln(nx, ny) + ln(-nx, -ny) : b.order === 3 ? ln(0, 0) + ln(2 * nx, 2 * ny) + ln(-2 * nx, -2 * ny) : ln(0, 0);

    === in b.order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Molar mass and group-contribution estimates.

  • Against a decimal process/env/cheminfo.js:179 in groupsOf CadCraft, BimCraft
    const dbl = nb[i].filter((x) => x.order === 2).length, trp = nb[i].filter((x) => x.order === 3).length, arom = nb[i].some((x) => x.order === 1.5);

    === in x.order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Molar mass and group-contribution estimates.

  • Against a decimal process/env/dispersion.js:100 in screen CadCraft, BimCraft
    const notes = ['Stability-class screening on flat ground, one source, no buildings. Ta ' + Ta + ' K' + (Ta === 293.15 ? ' (assumed: give the real ambient temperature)' : '') + '.',

    === in Ta === 293.15. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Stack plume rise and air dispersion screening.

  • Against a decimal process/env/molsketch.js:106 in fromMolecule CadCraft, BimCraft
    for (const b of mol.bonds) s.bonds.push({ a: b.a, b: b.b, order: b.order === 1.5 ? 1 : b.order });

    === in b.order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Not in the register.

  • Against a decimal process/env/molsketch.js:114 in kekulise CadCraft, BimCraft
    const arom = mol.bonds.map((b, k) => ({ k, a: b.a, b: b.b })).filter((e) => mol.bonds[e.k].order === 1.5 && need[e.a] && need[e.b]);

    === in mol.bonds[e.k].order === 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Not in the register.

  • Against a decimal process/equip/vessel.js:113 in flatHead CadCraft, BimCraft
    return { t, tMin: t + ca, C, notes: C === 0.33 ? ['C = 0.33 is the plain-plate value; the attachment detail of Figure UG-34 sets the real C (0.17 to 0.33 and others): give it'] : [], source: 'ASME VII

    === in C === 0.33. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Pressure vessel thickness and support formulas.

  • Against a decimal usd/util.js:60 in floatToHalf CadCraft, BimCraft, ModelCraft, TakeoffCraft, CivilCraft, DetailCraft, PartCraft
    return sign | (rest > 0.5 || (rest === 0.5 && (r & 1)) ? r + 1 : r);

    === in rest === 0.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Half floats in USD.

  • Two computed values bimcraft.js:4827 in update BimCraft
    for (const p of editor.placer().placements().filter((x) => x.uuid === r.uuid && Number(x.version) === Number(r.version))) {

    === in Number(x.version) === Number(r.version). Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Measurements and typed values in the main window.

  • Two computed values compute/parity.js:75 in compareImages BimCraft, ModelCraft
    if (ref.w !== test.w || ref.h !== test.h) throw new Error('parity: pictures of different sizes');

    !== in ref.w !== test.w. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Statistical comparison of rendered pictures.

  • Two computed values compute/parity.js:75 in compareImages BimCraft, ModelCraft
    if (ref.w !== test.w || ref.h !== test.h) throw new Error('parity: pictures of different sizes');

    !== in ref.h !== test.h. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Statistical comparison of rendered pictures.

  • Two computed values exr/exr.js:646 in get BimCraft, ModelCraft
    if (c.width === width && c.height === height) return (i) => c.data[i];

    === in c.width === width. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: OpenEXR and Radiance HDR picture files.

  • Two computed values exr/exr.js:646 in get BimCraft, ModelCraft
    if (c.width === width && c.height === height) return (i) => c.data[i];

    === in c.height === height. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: OpenEXR and Radiance HDR picture files.

  • Two computed values ifc/geo-tri.js:55 in ring BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (last && first !== last && last.x === first.x && last.y === first.y) remove(last), (last = last.prev);

    === in last.x === first.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:55 in ring BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (last && first !== last && last.x === first.x && last.y === first.y) remove(last), (last = last.prev);

    === in last.y === first.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:62 in rightmost BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    function rightmost(n) { let r = n, p = n; do { if (p.x > r.x || (p.x === r.x && p.y < r.y)) r = p; p = p.next; } while (p !== n); return r; }

    === in p.x === r.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:77 in bridgeHole BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (a.y !== b.y) {

    !== in a.y !== b.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:92 in bridgeHole BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (inside && !(p.x === m.x && p.y === m.y)) {

    === 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 by ear clipping.

  • Two computed values ifc/geo-tri.js:92 in bridgeHole BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (inside && !(p.x === m.x && p.y === m.y)) {

    === in p.y === m.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:118 in isEar BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (p.i !== a.i && p.i !== b.i && p.i !== c.i && (p.x !== a.x || p.y !== a.y) && (p.x !== c.x || p.y !== c.y) && (p.x !== b.x || p.y !== b.y) && inTri(a, b, c, p) && cross(p.prev, p, p.next) <= 0) ret

    !== in p.x !== a.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:118 in isEar BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (p.i !== a.i && p.i !== b.i && p.i !== c.i && (p.x !== a.x || p.y !== a.y) && (p.x !== c.x || p.y !== c.y) && (p.x !== b.x || p.y !== b.y) && inTri(a, b, c, p) && cross(p.prev, p, p.next) <= 0) ret

    !== in p.y !== a.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:118 in isEar BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (p.i !== a.i && p.i !== b.i && p.i !== c.i && (p.x !== a.x || p.y !== a.y) && (p.x !== c.x || p.y !== c.y) && (p.x !== b.x || p.y !== b.y) && inTri(a, b, c, p) && cross(p.prev, p, p.next) <= 0) ret

    !== in p.x !== c.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:118 in isEar BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (p.i !== a.i && p.i !== b.i && p.i !== c.i && (p.x !== a.x || p.y !== a.y) && (p.x !== c.x || p.y !== c.y) && (p.x !== b.x || p.y !== b.y) && inTri(a, b, c, p) && cross(p.prev, p, p.next) <= 0) ret

    !== in p.y !== c.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:118 in isEar BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (p.i !== a.i && p.i !== b.i && p.i !== c.i && (p.x !== a.x || p.y !== a.y) && (p.x !== c.x || p.y !== c.y) && (p.x !== b.x || p.y !== b.y) && inTri(a, b, c, p) && cross(p.prev, p, p.next) <= 0) ret

    !== in p.x !== b.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:118 in isEar BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if (p.i !== a.i && p.i !== b.i && p.i !== c.i && (p.x !== a.x || p.y !== a.y) && (p.x !== c.x || p.y !== c.y) && (p.x !== b.x || p.y !== b.y) && inTri(a, b, c, p) && cross(p.prev, p, p.next) <= 0) ret

    !== in p.y !== b.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:153 in between BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if ((a.x === b.x && a.y === b.y) || (c.x === b.x && c.y === b.y)) return false;

    === in a.x === b.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:153 in between BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if ((a.x === b.x && a.y === b.y) || (c.x === b.x && c.y === b.y)) return false;

    === in a.y === b.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:153 in between BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if ((a.x === b.x && a.y === b.y) || (c.x === b.x && c.y === b.y)) return false;

    === in c.x === b.x. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values ifc/geo-tri.js:153 in between BimCraft, TakeoffCraft, CivilCraft, DetailCraft
    if ((a.x === b.x && a.y === b.y) || (c.x === b.x && c.y === b.y)) return false;

    === in c.y === b.y. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Polygon triangulation by ear clipping.

  • Two computed values live.js:86 in end BimCraft
    if (was && now && was.t === now.t && JSON.stringify(enc(was.p)) === JSON.stringify(enc(now.p))) continue;

    === in was.t === now.t. 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 raster.js:171 in openAsc BimCraft, CivilCraft
    gt: [h.xll, h.dx, 0, h.yll + h.nrows * h.dy, 0, -h.dy], pixelIsPoint: false, cell: h.dx === h.dy ? h.dx : null,

    === in h.dx === h.dy. Compare within a documented epsilon scaled to the size of the geometry, or restructure so one side is exact. Reviewed: Elevation grids read from GeoTIFF and ASCII files.

  • Two computed values render/anim.js:129 in sortKeys BimCraft, ModelCraft
    for (const k of keys) { if (out.length && out[out.length - 1].t === k.t) out[out.length - 1] = k; else out.push(k); }

    === in out[out.length - 1].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 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/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 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 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.