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

  • Affine through three points

    The affine transform that carries three source points onto three destination points.

    det = (u₁ − u₀)(v₂ − v₀) − (u₂ − u₀)(v₁ − v₀); a = ((x₁ − x₀)(v₂ − v₀) − (x₂ − x₀)(v₁ − v₀)) ÷ det

    Map pictures warped onto the plan basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    32-bit, display only
  • Cells of a warped picture

    The cells a picture is cut into so that each can be drawn with one affine transform.

    split while max |affine(p) − exact(p)| > tol over the fourth corner, the middle and the four edge midpoints

    Map pictures warped onto the plan basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    32-bit, display only
  • Tile level for the screen

    Which level of a tile grid is drawn at the current zoom.

    the coarsest level with res ≤ 1.5 × screen resolution

    Map pictures warped onto the plan basemap.js
    • CadCraft
    • BimCraft
    • CivilCraft
    32-bit, display only
  • Meters per unit

    The length of a meter, an international foot and a US survey foot in meters.

    m = 1; ft = 0.3048; ftUS = 1200 ÷ 3937

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    Exact
  • Local system to grid and back

    Moves a point between project (ground or assumed) coordinates and grid coordinates.

    grid = to + k × R(θ) × (p − from); p = from + R(θ)ᵀ × (grid − to) ÷ k

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Project point to longitude and latitude and back

    The longitude and latitude (WGS 84) of a project point, and the project point of a longitude and latitude.

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Grid scale factor, convergence and elevation factor

    At a project point: the grid scale factor, the meridian convergence in degrees, the elevation factor and the combined factor.

    k_N = |p(φ+d) − p(φ−d)| ÷ (2 M d); k_E = |p(λ+d) − p(λ−d)| ÷ (2 N cos φ d); k = (k_N + k_E) ÷ 2; γ = −atan2(Δx, Δy); elevation = R ÷ (R + h), R = √(M N)

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Local system from two control points

    The scale and rotation that carry two points known in both local and grid coordinates onto each other.

    scale = |B − A| ÷ |b − a|; rotation = atan2(grid) − atan2(local), in degrees, brought into −180 to 180

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Ground coordinates about a base point

    A local system that scales by a combined factor about one base point, with no rotation.

    scale = combined; rotation = 0; from = to = base

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Any system to any system

    Converts a coordinate pair from one system's definition to another's.

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Matching a .prj to a catalog system

    Decides whether the projection in a .prj file is one of the catalog's systems, and if so uses the catalog's definition.

    |a − a′| < 1e-3; |e² − e′²| < 1e-9; distance at each of 3 probe points < 1e-3 (1e-9 for geographic)

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Probe points for matching

    Three longitude and latitude points inside a projection's zone, used to compare two definitions.

    (λ₀, φ), (λ₀ + 0.5°, φ + 0.5°), (λ₀ − 0.5°, φ + 0.25°)

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Linear unit of a .prj

    Decides whether a projection is in meters, international feet or US survey feet.

    |k − 1| < 1e-12 → m; |k − 0.3048| < 1e-10 → ft; |k − 1200 ÷ 3937| < 1e-10 → ftUS

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Extent of a grid shift file

    The west, south, east and north limits, in degrees, of the area a loaded grid shift file covers.

    east = −λ_ll × 180 ÷ π; west = −(λ_ll + (n_λ − 1) × Δλ) × 180 ÷ π; north = (φ_ll + (n_φ − 1) × Δφ) × 180 ÷ π

    Coordinate reference systems crs.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • UTM zone to EPSG code

    The EPSG number of a UTM zone typed as text such as UTM 33N.

    WGS 84: 32600 + zone (north), 32700 + zone (south); NAD83: 26900 + zone; ETRS89: 25800 + zone; GDA94: 28300 + zone; GDA2020: 7800 + zone

    Coordinate reference systems crs-pick-shared.js
    • CadCraft
    • BimCraft
    • CivilCraft
    Exact
  • Linear unit of a typed definition

    Decides whether a typed projection definition is in meters, international feet, US survey feet or degrees.

    |k − 1| < 1e-12 → m; |k − 0.3048| < 1e-10 → ft; |k − 1200 ÷ 3937| < 1e-10 → ftUS

    Coordinate reference systems crs-pick-shared.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Probe points for a typed definition

    Three longitude and latitude points inside the definition's zone, used to compare it with catalog systems.

    Coordinate reference systems crs-pick-shared.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Matching a typed definition to the catalog

    Finds the catalog systems that give the same easting and northing as a typed definition.

    same projection family; |a − a′| ≤ 1e-3; |e² − e′²| ≤ 1e-9; distance at each of 3 probe points < 1e-3

    Coordinate reference systems crs-pick-shared.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Round-trip check of a typed definition

    Refuses a typed projection that does not return its own probe point.

    |inverse(forward(λ, φ)) − (λ, φ)| < 1e-6 degrees in each of λ and φ

    Coordinate reference systems crs-pick-shared.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Do two systems give the same coordinates

    Says whether two systems give the same easting and northing.

    same unit and distance at each of 3 probe points < 1e-3

    Coordinate reference systems crs-pick-shared.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • A group value by its code

    Turns one group's text into a real number, a whole number, a true or false, or text.

    codes 10–59, 110–149, 210–239, 460–469, 1010–1059: parseFloat; 60–99, 160–179, 270–289, 370–389, 400–409, 420–429, 440–459, 1060–1071: parseInt

    DXF reading into the shared drawing model dxf-model.js
    • CadCraft
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Arc angles

    An arc's start and end angles in radians.

    angle = degrees × (π ÷ 180)

    DXF reading into the shared drawing model dxf-model.js
    • CadCraft
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Multi-line text direction

    The direction vector of multi-line text, from the file's vector or from its rotation angle.

    x axis = group 11 when present; otherwise (cos(a), sin(a)), a = degrees × (π ÷ 180)

    DXF reading into the shared drawing model dxf-model.js
    • CadCraft
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • Hatch arc and ellipse edges

    The center, radius or axes, and start and end angles of the curved edges of a hatch boundary.

    angle = degrees × (π ÷ 180); missing end angle = 360 degrees

    DXF reading into the shared drawing model dxf-model.js
    • CadCraft
    • BimCraft
    • TakeoffCraft
    • CivilCraft
    64-bit
  • abs, round, ceil and floor

    The four functions an expression may call.

    round(x) = floor(x + 0.5) for x ≥ 0, −floor(−x + 0.5) for x < 0; ceil(x) = ⌈x − 1e-9·max(1, |x|)⌉; floor(x) = ⌊x + 1e-9·max(1, |x|)⌋

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Adding and subtracting

    Sums and differences of lengths, left to right.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Multiplying and dividing

    Products and quotients of a length and plain numbers, left to right.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • The answer

    The final value and whether it is a length or a plain number.

    Arithmetic on typed lengths lencalc.js
    • CadCraft
    • ModelCraft
    • MarkupCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    64-bit
  • Unit sizes

    Builds each unit's row: its fraction of the base unit and the factor used for quick conversion.

    factor = n ÷ d (× π for degrees and gons)

    Unit table: reading and writing values unit-table.js Every app
    Exact
  • Numbers and fractions

    Reads 6, 6.5, 6 1/2, 6-1/2 or 1/2 as a number.

    whole + numerator ÷ denominator

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Feet and inches

    Reads 12'6", 12'-6 1/2" or 6" as inches.

    inches = feet × 12 + inches

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Degrees, minutes and seconds

    Reads 45°30'15" or 45d30m15s as degrees.

    degrees + minutes ÷ 60 + seconds ÷ 3600

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Slopes

    Reads 2%, 3H:1V, 1:3 or 6/12 as a grade (rise over run).

    percent ÷ 100; H:V → V ÷ H; rise:run → rise ÷ run

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Writing feet and inches

    Writes a length as feet, inches and a fraction of an inch.

    n = round(|inches| × den); feet = ⌊n ÷ 12den⌋; inches = ⌊rest ÷ den⌋; fraction = rest ÷ den, reduced

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Writing degrees, minutes and seconds

    Writes an angle as degrees, minutes and seconds.

    t = round(|degrees| × 3600 × 10^dec); split by 3600 and 60

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • Writing decimals

    Writes a number with a fixed count of decimals.

    text = v.toFixed(dec)

    Unit table: reading and writing values unit-table.js Every app
    64-bit
  • A level written as text

    Reads a level such as 104.37, +104,37 or EL 104.37 from a text.

    value = Number(whole digits . decimal digits) × sign

    Survey levels from text and the survey check survey.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Levels into project units

    A level point's x, y and z in project units.

    x·k, y·k, z·k

    Survey levels from text and the survey check survey.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Extent and distance from the origin

    How far the data spans and how far it lies from zero, in meters.

    span = |(maxX − minX, maxY − minY)| × m per unit; far = max |coordinate| × m per unit

    Survey levels from text and the survey check survey.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Median

    The middle value of a list of levels.

    odd count: the middle value; even: mean of the two middle values

    Survey levels from text and the survey check survey.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Level outliers

    Counts levels that are far from the rest, and levels of exactly 0 that look like missing heights.

    MAD = median(|z − median|) × 1.4826; limit = max(6 × MAD, 5 m); outlier when |z − median| > limit

    Survey levels from text and the survey check survey.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Duplicate points

    Counts points that sit on top of another point, with the same or a different level.

    cell = 1 mm; key = (round(x ÷ cell), round(y ÷ cell)); same level when |Δz| ≤ cell

    Survey levels from text and the survey check survey.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Height unit factor

    The factor that turns a file's heights into the project's unit.

    factor = meters per file unit ÷ meters per project unit

    Elevation grids into survey points and a grid surface terrain.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Cell center in the file's coordinates

    The x and y of a raster cell's center.

    x = g₀ + (col + 0.5)·g₁ + (row + 0.5)·g₂; y = g₃ + (col + 0.5)·g₄ + (row + 0.5)·g₅

    Elevation grids into survey points and a grid surface terrain.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Cells inside a box

    The range of columns and rows whose centers can fall inside a picked box.

    (col, row) = G⁻¹·(x − g₀, y − g₃) − 0.5; c₀ = ⌈min − 1e-9⌉, c₁ = ⌊max + 1e-9⌋ + 1

    Elevation grids into survey points and a grid surface terrain.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • A box through a coordinate conversion

    The box round a rectangle after its outline is converted to another coordinate system.

    17 points along each side, converted, then minimum and maximum

    Elevation grids into survey points and a grid surface terrain.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Survey points from a grid

    One survey point per grid node that has a height.

    (x, y) = conversion(cell center); z = file height × unit factor

    Elevation grids into survey points and a grid surface terrain.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Grid surface

    A triangulated surface from the grid: two triangles per cell.

    cell corners a (SW), b (SE), c (NE), d (NW): triangles a–b–c and a–c–d

    Elevation grids into survey points and a grid surface terrain.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • 1-2-5 step

    Rounds a step up to 1, 2 or 5 times a power of ten.

    p = 10^⌊log₁₀ x⌋; m = x ÷ p; 1, 2, 5 or 10 × p

    Elevation grids into survey points and a grid surface terrain.js
    • CadCraft
    • BimCraft
    • CivilCraft
    64-bit
  • Guard on every written measure

    Decides what is written when a value is missing or not a number.

    DWG object values written and read dwg/objects-write.js
    • CadCraft
    • BimCraft
    • ModelCraft
    • TakeoffCraft
    • CivilCraft
    • DetailCraft
    • PartCraft
    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.