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 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. -
Against a decimal io/pbr.js:49 in gltfToOpenPBR ModelCraft
if (m.ior !== 1.5) p.specular_ior = m.ior;!== in
m.ior !== 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Imported material parameters. -
Against a decimal io/pbr.js:107 in openPBRToGltf ModelCraft
if (p.specular_ior !== undefined && p.specular_ior !== 1.5) ext('KHR_materials_ior', { ior: round(p.specular_ior) });!== in
p.specular_ior !== 1.5. Compare within a documented epsilon, or test with < or > if a range is meant. Reviewed: Imported material parameters. -
Against a decimal tools.js:1542 in computeGrips ModelCraft
if (f.every((x) => x === 0.5)) continue;=== in
x === 0.5. Compare within a documented epsilon, or test with < or > if a range is meant. Not in the register. -
Against a decimal tools.js:1543 in computeGrips ModelCraft
const mask = f.map((x, a) => x !== 0.5 && live[a]);!== in
x !== 0.5. Compare within a documented epsilon, or test with < or > if a range is meant. Not in the register.