Resources Numerical accuracy

Calculations

Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.

  • 6,917 calculations in 1,248 source files
  • 143 exact
  • 6,286 in 64-bit
  • 335 with a 32-bit step
  • Last reviewed

Calculations

  • Traced arc to points

    Turns an arc found on the scan into points for a line layer.

    n = max(2, ⌈|sweep| ÷ 5°⌉); point = center + r·(cos t, sin t)

    Placing a scanned sheet in the project scanstart/place.js
    • CivilCraft
    64-bit
  • Traced lines in project coordinates

    The lines and arcs traced on the scan as one line layer in project coordinates.

    each end point through the placement; kept when its length > the minimum

    Placing a scanned sheet in the project scanstart/place.js
    • CivilCraft
    64-bit
  • Point coordinates

    The x, y and z of one point record.

    x = X × scaleₓ + offsetₓ (and the same for y and z)

    LAS and LAZ point coordinates las.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Scale, offset and bounds from the header

    Reads the header's scale, offset, minimum and maximum and refuses a scale that cannot be used.

    LAS and LAZ point coordinates las.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 64-bit counts and offsets

    Reads an unsigned 64-bit integer (LAS 1.4 point count, extended record positions and lengths).

    value = hi × 2³² + lo

    LAS and LAZ point coordinates las.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Points the file really holds

    The number of whole point records between the first point and the end of the point data.

    available = ⌊(end − offset to points) ÷ record length⌋, at most the header's count

    LAS and LAZ point coordinates las.js
    • CadCraft
    • BimCraft
    • CivilCraft
    Exact
  • Tightest limit of a rule

    The minimum and maximum a rule allows when several ticked packs have it.

    min = max(minᵢ); max = min(maxᵢ)

    Regulation limits in force and how values are written addons/regs/lib/adapter.js
    • CadCraft
    • BimCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Values written in a problem

    How a required or found value is written in a regulation problem, by unit.

    mm: round(v × 10) ÷ 10; m²: round(v × 100) ÷ 100; ratio and U: 2 decimals; R: 1 decimal; count: whole

    Regulation limits in force and how values are written addons/regs/lib/adapter.js
    • CadCraft
    • BimCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Percentages as text

    A percentage written in the panel, in problems and on the code summary sheet.

    round(v × 10) ÷ 10, then the browser's number format with at most one decimal

    Regulation limits in force and how values are written addons/regs/lib/ui.js
    • CadCraft
    • BimCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Values on the code summary sheet

    Required and found values on the printable code summary for a permit set.

    Regulation limits in force and how values are written addons/regs/lib/ui.js
    • CadCraft
    • BimCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Raw double, read

    A 64-bit value read from eight bytes of the bit stream.

    Numbers in a DWG file, read and written bit for bit dwg/bits-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Bit double, read

    A value stored as a two-bit code: a full 64-bit value, exactly 1.0 or exactly 0.0.

    Numbers in a DWG file, read and written bit for bit dwg/bits-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Double with default, read

    A value stored as the bytes in which it differs from a default value.

    Numbers in a DWG file, read and written bit for bit dwg/bits-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • 64-bit whole number, read

    An unsigned 64-bit whole number from two 32-bit halves.

    value = high × 2³² + low

    Numbers in a DWG file, read and written bit for bit dwg/bits-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Bit long long, read

    A whole number of up to seven bytes, the count given by three bits.

    value = Σ byteᵢ × 256ⁱ

    Numbers in a DWG file, read and written bit for bit dwg/bits-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Handle reference, read

    An object handle, absolute or as an offset from another handle.

    value = Σ byte × 256ᵏ; codes 6, 8, A, C: ref + 1, ref − 1, ref + value, ref − value

    Numbers in a DWG file, read and written bit for bit dwg/bits-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Modular char, read

    A signed whole number stored seven bits per byte.

    value = Σ (byte & 0x7F) × 2^(7i); the last byte carries 6 bits and the sign

    Numbers in a DWG file, read and written bit for bit dwg/bits-read.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Raw double, written

    A 64-bit value written as its eight bytes.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Bit double, written

    A value written as a two-bit code for exactly 0.0 or 1.0, or as a full 64-bit value.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Double with default, written

    A value written as a two-bit code when it equals its default, or in full.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Thickness, written

    A thickness written as one bit when it is zero, or as a bit double.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Bit long, written

    A 32-bit whole number in its short or full form.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    Exact
  • Bit short, written

    A 16-bit whole number in its short or full form.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    Exact
  • Bit long long, written

    A 64-bit whole number as a three-bit byte count and its bytes.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    Exact
  • Point, written

    The three coordinates of a point as bit doubles.

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Handle bytes, written

    A handle as its bytes, most significant first.

    byte = v mod 256; v = ⌊v ÷ 256⌋

    Numbers in a DWG file, read and written bit for bit dwg/bits-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    Exact
  • Lineweight to stored index

    The index written for a lineweight, or the codes for by layer, by block and default.

    index of the list value with the smallest |value − lineweight|

    Lineweights in a DWG file dwg/model.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    Exact
  • Stored index to lineweight

    The lineweight for an index read from a file.

    Lineweights in a DWG file dwg/model.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    Exact
  • Rational tag value

    A TIFF RATIONAL (two 32-bit integers) as one number.

    value = numerator ÷ denominator

    TIFF scan resolution raster/tiff.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Resolution in dots per inch

    The horizontal and vertical resolution of a page, in dots per inch.

    dpi = resolution × 2.54 (centimeter files); dpi = resolution (inch files)

    TIFF scan resolution raster/tiff.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • CivilCraft
    • PartCraft
    64-bit
  • Triangulate a polygon with holes

    The triangles of a polygon, as indexes into its point list.

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Winding of a ring

    Whether a ring runs clockwise or counterclockwise.

    sum = Σ (xⱼ − xᵢ) × (yᵢ + yⱼ)

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Orientation of three points

    On which side of the line through two points a third point lies.

    area = (q.y − p.y) × (r.x − q.x) − (q.x − p.x) × (r.y − q.y)

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Removing duplicate and collinear points

    Drops points that repeat their neighbor or lie on the line between their neighbors.

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Ear test

    Whether a corner can be cut off as a triangle: it is convex and no other point of the ring lies inside it.

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Point in triangle

    Whether a point lies inside or on a triangle.

    three cross products of (corner − point) pairs, each ≥ 0

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Bridge from a hole to the outer ring

    The point of the outer ring a hole is connected to.

    x = p.x + (h.y − p.y) × (p′.x − p.x) ÷ (p′.y − p.y); tan = |h.y − p.y| ÷ (h.x − p.x)

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Do two segments cross

    Whether two edges intersect, including touching and collinear overlap.

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Is the middle of a diagonal inside the polygon

    Whether a diagonal between two corners runs through the inside of the polygon.

    midpoint = ((a.x + b.x) ÷ 2, (a.y + b.y) ÷ 2); even-odd count of edges crossed by a ray

    Polygon triangulation (ear clipping) usd/earcut.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    64-bit
  • Is a ray to the sun blocked

    Whether the line from a point toward the sun meets a triangle of the model.

    det = e₁ · (d × e₂); u = (t · (d × e₂)) ÷ det; v = (d · (t × e₁)) ÷ det; hit if 0 ≤ u, 0 ≤ v, u + v ≤ 1 and distance > tMin

    Solar array shading pv-shade.js
    • BimCraft
    • CivilCraft
    64-bit
  • Sample points on the modules

    The points on each module from which rays are cast.

    p = bilinear blend of the four corners at ((a + ½) ÷ k, (b + ½) ÷ k) + normal × lift

    Solar array shading pv-shade.js
    • BimCraft
    • CivilCraft
    64-bit
  • Shade fraction by month and hour

    The share of the sample points in shadow at each of 12 × 24 sun positions.

    frac = shaded points ÷ points

    Solar array shading pv-shade.js
    • BimCraft
    • CivilCraft
    64-bit
  • Beam light lost to shadows

    The share of the direct sunlight the array loses to shading, over the year or chosen months.

    loss = Σ beam × frac ÷ Σ beam

    Solar array shading pv-shade.js
    • BimCraft
    • CivilCraft
    64-bit
  • Module voltage at a temperature

    The open-circuit voltage of a module at a cell temperature.

    V(T) = V × (1 + β × (T − 25))

    Solar string sizing pv-string.js
    • BimCraft
    • CivilCraft
    64-bit
  • Longest and shortest string

    The most and the fewest modules a string may have.

    nMax = min(⌊V_limit ÷ (Voc,cold × f) + 1e-9⌋, ⌊MPPT max ÷ Vmp,cold + 1e-9⌋); nMin = ⌈MPPT min ÷ Vmp,hot − 1e-9⌉

    Solar string sizing pv-string.js
    • BimCraft
    • CivilCraft
    64-bit
  • String length and number of strings

    The string length inside the window that leaves the fewest modules over.

    count = ⌊modules ÷ n⌋; left = modules − count × n

    Solar string sizing pv-string.js
    • BimCraft
    • CivilCraft
    Exact
  • String voltage checks

    The string's cold and hot voltages against the inverter's and the system's limits.

    V_string = round(n × round(V_module, 2 decimals), 2 decimals)

    Solar string sizing pv-string.js
    • BimCraft
    • CivilCraft
    64-bit
  • Strings per inverter input

    How many strings one input can carry by its current limits, and how many inputs are needed.

    per input = min(⌊I_dc max ÷ Imp + 1e-9⌋, ⌊I_sc max ÷ Isc + 1e-9⌋); inputs needed = ⌈count ÷ per input⌉

    Solar string sizing pv-string.js
    • BimCraft
    • CivilCraft
    64-bit
  • DC to AC ratio

    The array's peak power against the inverter's AC rating.

    kWp = n × count × Wp ÷ 1000; DC ÷ AC = kWp ÷ (P_ac × inverters)

    Solar string sizing pv-string.js
    • BimCraft
    • CivilCraft
    64-bit
  • Cell temperature

    The temperature of the cells from the air temperature and the light on the module.

    T_cell = T_amb + (NOCT − 20) ÷ 800 × G

    Solar yield estimate pv-yield.js
    • BimCraft
    • CivilCraft
    64-bit

A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.