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 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 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 base-ui.js:580 in scaleFor MarkupCraft
if (keep) { const s = Math.max(Math.abs(sx === 1 && !grip.key.match(/[ew]/) ? sy : sx), Math.abs(sy === 1 && !grip.key.match(/[ns]/) ? sx : sy)); sx = Math.sign(sx) * s; sy = Math.sign(sy) * s; }=== 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 base-ui.js:580 in scaleFor MarkupCraft
if (keep) { const s = Math.max(Math.abs(sx === 1 && !grip.key.match(/[ew]/) ? sy : sx), Math.abs(sy === 1 && !grip.key.match(/[ns]/) ? sx : sy)); sx = Math.sign(sx) * s; sy = Math.sign(sy) * s; }=== 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 clip.js:82 in cleanClip MarkupCraft
if (!d || typeof d !== 'object' || d.format !== CLIP_FORMAT || d.v !== 1 || !Array.isArray(d.items)) 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: Area markup with cut-outs, and clipboard placement. -
Against 1 content-clip.js:86 in cleanContentClip MarkupCraft
if (!d || typeof d !== 'object' || d.format !== CONTENT_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: Carried, stamped and pasted markup geometry. -
Against 1 markupcraft.js:4498 in recover MarkupCraft
if (!rec.data?.pdf || !st || st.v !== 1) throw new Error(t('recover.bad'));!== in
st.v !== 1. Fine for a value that is set, not computed (a default scale). If it comes from a calculation, use an epsilon. Reviewed: Sheet scale, typed lengths and measured values, Markup geometry while drawing and editing, Drawing comparison by vector paths. -
Against 1 pdf-read.js:146 in fromPrivate MarkupCraft
if (!d || typeof d !== 'object' || d.v !== 1 || typeof d.type !== 'string' || !TYPES[d.type] || d.type === 'foreign') 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: Annotations and scales read from a PDF. -
Against 1 records.js:156 in unpackRecords MarkupCraft
if (!v || typeof v !== 'object' || v.v !== 1 || !Array.isArray(v.records)) return [];!== in
v.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.