Resources Numerical accuracy Calculation policy

Quantities sent in a bid package

Sends each scope line's quantity and unit to the bidding service.

How the precision is kept

The quantity is the takeoff's 64-bit value, rounded to 4 decimals at the moment it is put in the package. Nothing else is computed here.

Open item. Send the quantity as measured, or state on the package that quantities are rounded to 4 decimals.

Calculations under this policy

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.

bidsend.js TakeoffCraft 0.8.1 64-bit 2 calculations Reviewed

Tests bin/test-takeoffcraft.mjs

Quantity rounded for the package

64-bit

Rounds a quantity to 4 decimals before it is sent.

qty = round(v × 10000) ÷ 10000

Math.round(v × 10000) ÷ 10000: the product is rounded to a whole number, an exact half going toward +∞, then divided once. A non-finite value becomes null. The rounded value is what leaves the app.

  • bidsend.js
  • line 28
  • TakeoffCraft 0.8.1
const money = (v) => (typeof v === 'number' && Number.isFinite(v) ? Math.round(v * 10000) / 10000 : null);

Scope lines of a package

64-bit

Builds the lines of a bid package: item, quantity, unit and sheets.

Each line's quantity passes through the 4-decimal rounding above; the unit and names are copied.

  • bidsend.js
  • lines 30 to 33
  • TakeoffCraft 0.8.1
/** The package's lines for the site. sheetLabel(sheetKey) names a sheet. */
export function scopeLines(pkg, sheetLabel = (k) => k) {
  return pkg.items.map((x) => ({ key: x.itemId, name: x.name, csi: x.csi || '', qty: money(x.qty), unit: x.unit || '', sheets: x.sheets.map(sheetLabel).join('; ').slice(0, 200) }));
}

In detail

Method
qty = round(v × 10000) ÷ 10000; a value that is not a finite number is sent as null.
Number types
64-bit numbers, written as JSON.
Limits
A bidder sees the quantity to 4 decimals of the item's unit, not the full measured value.

Approach: 64-bit, direct

Every value is a 64-bit number from input to result. Formulas are closed form or a direct solve, and every comparison uses a stated tolerance.

Every policy that takes this approach