Round to 3 decimals
64-bitThe rounding applied to every coordinate in the package.
round(v × 1000) ÷ 1000
One 64-bit multiply, round and divide. The exported coordinate keeps 3 decimals only.
const r3 = (v) => Math.round(v * 1000) / 1000;
Resources Numerical accuracy Calculation policy
The positions written into a redline package that lists each markup on its sheet.
Each markup's box and points are written twice, in points and as fractions of the sheet, and every value is rounded to 3 decimals.
2 calculations in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.
Tests None found by the review
The rounding applied to every coordinate in the package.
round(v × 1000) ÷ 1000
One 64-bit multiply, round and divide. The exported coordinate keeps 3 decimals only.
const r3 = (v) => Math.round(v * 1000) / 1000;
A markup's box and points as fractions of the sheet's width and height.
fx = (x − x₀) ÷ w; fy = (y − y₀) ÷ h
The subtraction and division are 64-bit and the result goes through r3. w and h come from the sheet view box and there is no check for a zero size.
const w = s.view[2] - s.view[0], h = s.view[3] - s.view[1];
const f = (x, y) => [r3((x - s.view[0]) / w), r3((y - s.view[1]) / h)];
const lo = f(b[0], b[1]), hi = f(b[2], b[3]);
The arithmetic is 64-bit, but the method or the data sets the accuracy: a solver tolerance, a mesh, a step size, a datum shift, a table. The limit is stated where the result is shown.