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 whole number people-sim.js:142 in field BimCraft
if (Math.abs(di) + Math.abs(dj) === 2 && (!free[cj * nx + i] || !free[j * nx + ci])) continue; // no cutting a corner=== in
Math.abs(di) + Math.abs(dj) === 2. Check that the value is exact by construction; if not, compare within an epsilon. Reviewed: People movement and travel distance. -
Against a whole number people-sim.js:143 in field BimCraft
if (Math.abs(di) === 2 && (!free[cj * nx + ci + di / 2] || !free[j * nx + ci + di / 2])) continue; // knight move: both middle cells free=== in
Math.abs(di) === 2. Check that the value is exact by construction; if not, compare within an epsilon. Reviewed: People movement and travel distance. -
Against a whole number people-sim.js:144 in field BimCraft
if (Math.abs(dj) === 2 && (!free[(cj + dj / 2) * nx + ci] || !free[(cj + dj / 2) * nx + i])) continue;=== in
Math.abs(dj) === 2. Check that the value is exact by construction; if not, compare within an epsilon. Reviewed: People movement and travel distance.