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

  • Coordinate and aperture format

    How a position and an aperture size are written in a Gerber file.

    X, Y = round(mm × 10⁶); size = 6 decimals

    Gerber and drill file numbers gerber.js Every app
    64-bit
  • Pad as a flash or a region

    A pad, or its grown copy for the solder mask, in the file.

    axis-aligned: aperture (w + 2 × grow) by (h + 2 × grow); else a 4-corner region rotated by the pad angle

    Gerber and drill file numbers gerber.js Every app
    64-bit
  • Drill sizes and positions

    The tool table and hole positions of the drill files.

    tool size = 3 decimals; X, Y = 4 decimals of a millimeter

    Gerber and drill file numbers gerber.js Every app
    64-bit
  • Board size in the job file

    The board's width and height stated in the job file.

    size = extent of the outline, 4 decimals

    Gerber and drill file numbers gerber.js Every app
    64-bit
  • Coordinate scale when reading

    The factor that turns the file's integers into coordinates.

    scale = 10^(−decimals of X)

    Gerber and drill file numbers gerber.js Every app
    64-bit
  • Coordinates when reading

    Each X and Y of a Gerber file as a number.

    x = integer × scale

    Gerber and drill file numbers gerber.js Every app
    64-bit
  • Drill file when reading

    Tool diameters and hole positions read back from a drill file.

    decimal text to the nearest 64-bit number

    Gerber and drill file numbers gerber.js Every app
    64-bit
  • Real number when reading

    An 8-byte GDSII real as a number.

    value = sign × (mantissa ÷ 2⁵⁶) × 16^(exponent − 64)

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Real number when writing

    A number as an 8-byte GDSII real.

    mantissa = round(v × 2⁵⁶) after scaling v into [1/16, 1) by powers of 16

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    Exact
  • Database unit

    User units per database unit and meters per database unit, read from the file.

    two 8-byte reals from the UNITS record

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Integers written to the stream

    Coordinates, widths, layers and array counts as the file stores them.

    coordinates and widths: 32-bit signed; layers and counts: 16-bit signed

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Placement transform

    A referenced cell's points reflected, magnified, rotated and moved.

    (x, y) → mag × (x, ±y), rotated by the angle in degrees, then translated

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Nested placements

    The combined transform of a cell placed inside a placed cell.

    mag = mag_parent × mag_child; angle = angle_parent ± angle_child; reflection toggles

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Array placement

    The position of each copy in a rows-by-columns array.

    position(i, j) = origin + i × (c − o) ÷ cols + j × (r − o) ÷ rows

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Path outline

    A path with a width turned into a polygon.

    offset = ± half width along the corner bisector ÷ max(0.2, cos of the half angle)

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Database units to user units

    Flattened coordinates in the file's user unit, usually micrometers.

    x_user = x_db × userPerDb

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Shapes and area per layer

    How many shapes each layer has and their total area.

    area = Σ |shoelace area|

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Width, spacing and area checks

    Shapes that are narrower, closer or smaller than a rule allows.

    area < minArea − 1e-12; 0 < distance < minSpace − 1e-12; facing-edge width < minWidth − 1e-12

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Narrowest width of a shape

    The smallest distance between two edges that face each other across the inside.

    distance from one edge's line to the other, for antiparallel edges that overlap

    GDSII layout: reals, flattening, areas and checks gds.js Every app
    64-bit
  • Half-perimeter wire length

    The estimate of total connection length reported before and after placement.

    Σ over nets of (x_max − x_min) + (y_max − y_min)

    Board placement and routing place.js Every app
    64-bit
  • Overlap and outline penalties

    The cost added when courtyards overlap or reach outside the board.

    cost = 50 × (overlap area + area outside the margin)

    Board placement and routing place.js Every app
    64-bit
  • Annealing schedule

    How the search cools from large moves to small ones.

    T₀ = max(1, 0.15 (W + H)); T_end = 0.002 (W + H); T ← T × (T_end ÷ T₀)^(1 ÷ iterations)

    Board placement and routing place.js Every app
    64-bit
  • Final part positions

    The positions stored on the board when placement ends.

    x, y = round(value × 1000) ÷ 1000

    Board placement and routing place.js Every app
    64-bit
  • Routing grid

    The grid of points tracks may pass through.

    pitch = (track width + clearance) ÷ 2 by default; x = ox + i × pitch

    Board placement and routing route.js Every app
    64-bit
  • Obstacle map

    Which grid points a track or a via of another net may not use.

    blocked when distance to copper < clearance + track width ÷ 2 + 0.25 × pitch

    Board placement and routing route.js Every app
    64-bit
  • Track points

    The corner points of a routed track.

    drop a point when |(b − a) × (c − b)| ≤ 1e-9

    Board placement and routing route.js Every app
    64-bit
  • Wrap into an integer type

    A number brought into the range of SINT, INT, DINT and the other integer types.

    v mod 2ⁿ, moved into the signed range

    Controller standard functions and integer types std.js Every app
    Exact
  • On-delay timer

    The elapsed time and output of a TON block.

    ET = min(now − t₀, PT); Q = ET ≥ PT

    Controller standard functions and integer types std.js Every app
    64-bit
  • Up counter

    The count and output of a CTU block.

    CV ← CV + 1 on a rising edge while CV < 32767; Q = CV ≥ PV

    Controller standard functions and integer types std.js Every app
    Exact
  • Round to nearest, ties to even

    The rounding used when a real is converted to an integer.

    nearest whole number; a tie goes to the even neighbor

    Controller standard functions and integer types std.js Every app
    Exact
  • Arithmetic functions

    ABS, SQRT, LN, LOG, EXP, the trigonometric functions, MIN, MAX, LIMIT, TRUNC, SHL and SHR.

    SQRT, LN, LOG, EXP, SIN and the rest from Math; SHL: x × 2ⁿ; SHR: ⌊x ÷ 2ⁿ⌋; TRUNC toward zero

    Controller standard functions and integer types std.js Every app
    64-bit
  • Type conversions

    REAL_TO_INT, INT_TO_REAL, BOOL_TO_INT, TIME_TO_REAL and the other A_TO_B functions.

    to an integer type: round to nearest (ties to even), then wrap; to a real type: unchanged

    Controller standard functions and integer types std.js Every app
    64-bit
  • Probability of a basic event

    The probability of an event from a fixed value, a failure rate and time, a test interval, or repair data.

    failed by t: 1 − e^(−λt); tested every τ: 1 − (1 − e^(−λτ)) ÷ (λτ), or λτ ÷ 2 below 1e-9; repairable: MTTR ÷ (MTTF + MTTR)

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • At least k of n events

    The probability that k or more of a set of independent events occur.

    the distribution of the count, built one event at a time, summed from k up

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • AND, OR and voting gates

    The probability of a gate from its inputs when no event is repeated.

    AND: Π pᵢ; OR: 1 − Π (1 − pᵢ)

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Top event with repeated events

    The probability of the top event when the same event appears in several places.

    P = p_x × P(tree | x occurs) + (1 − p_x) × P(tree | x does not)

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Cut set probabilities and bounds

    The probability of each minimal cut set and two bounds on the top event.

    rare event: min(1, Σ P(cut set)); upper bound: 1 − Π (1 − P(cut set))

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Importance measures

    How much each event matters to the top event.

    Birnbaum = P(top | p = 1) − P(top | p = 0); Fussell–Vesely = (P − P₀) ÷ P; RAW = P₁ ÷ P; RRW = P ÷ P₀

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Reliability of a component

    The chance a block still works at the mission time.

    R = e^(−λt); Weibull: R = e^(−(t ÷ η)^β)

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Block diagram reliability

    The reliability of series, parallel and k-of-n arrangements.

    series = OR of failures; parallel = AND; reliability = 1 − P(failure)

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Mean time to failure

    The mean life of a system that is not repaired.

    MTTF = ∫ R(t) dt by Simpson's rule, 4000 steps, to the time R ≤ 1e-9

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Common-cause split

    The independent and the shared part of a failure rate.

    independent = λ (1 − β); common = λ β

    Fault trees and reliability block diagrams logic.js Every app
    64-bit
  • Gamma function

    Γ(x), used for the mean life.

    Lanczos approximation, g = 7, 9 coefficients; reflection below 0.5

    Weibull life data weibull.js Every app
    64-bit
  • Weibull distribution functions

    Failure probability, reliability, density, hazard, quantile, mean and B-life.

    F = 1 − e^(−(t ÷ η)^β); quantile = η (−ln(1 − F))^(1 ÷ β); mean = η Γ(1 + 1 ÷ β)

    Weibull life data weibull.js Every app
    64-bit
  • Log-likelihood

    How well a shape and scale explain the failure and suspension times.

    Σ failures ln f(t) + Σ suspended ln R(t)

    Weibull life data weibull.js Every app
    64-bit
  • Maximum-likelihood fit

    Shape, scale and their confidence bounds from failure times, with suspensions.

    g(β) = Σ tᵝ ln t ÷ Σ tᵝ − 1 ÷ β − mean ln t = 0; η = (Σ tᵝ ÷ r)^(1 ÷ β)

    Weibull life data weibull.js Every app
    64-bit
  • Median ranks

    The plotting position of each failure, adjusted for suspended units.

    F = (rank − 0.3) ÷ (n + 0.4); rank increment = (n + 1 − previous rank) ÷ (1 + units at or after this one)

    Weibull life data weibull.js Every app
    64-bit
  • Rank regression fit

    Shape and scale from a straight line on the Weibull plot.

    β = S_xy ÷ S_xx on (ln t, ln(−ln(1 − F))); η = e^(−a ÷ β)

    Weibull life data weibull.js Every app
    64-bit
  • Duration drawn for a task

    One trial's duration of a task given as minimum, most likely and maximum.

    u < f: min + √(u (max − min)(mode − min)); else max − √((1 − u)(max − min)(max − mode)); duration = round(v)

    Schedule risk (Monte Carlo) simulate.js Every app
    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.