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

  • Convert between two units

    A value in one unit as a value in another unit of the same kind.

    result = v × (n₁ × d₂) ÷ (d₁ × n₂)

    Unit conversion unit-table.js Every app
    Exact
  • Typed text to a unit

    What was typed, with its unit, as a value in the unit the field wants.

    3 yd typed into a feet field = convert(3, yd, ft) = 9

    Unit conversion unit-table.js Every app
    Exact
  • A value to the base unit

    A number in any unit as meters, square meters, cubic meters, radians or rise over run.

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

    Unit conversion unit-table.js Every app
    64-bit
  • A base value to a unit

    A stored base value as a number in the unit shown.

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

    Unit conversion unit-table.js Every app
    64-bit
  • Add, subtract, multiply, divide

    The four operations on values that carry units.

    a + b and a − b need the same dimensions; a × b and a ÷ b combine them

    Calc sheets calc.js Every app
    64-bit
  • Comparisons

    Pass or fail checks such as M <= 40 kN m.

    a ≤ b is true when a ≤ b + 1e-12 × max(1, |a|, |b|)

    Calc sheets calc.js Every app
    64-bit
  • Number shown

    A result as text in the sheet.

    6 significant digits; exponent form from 1e9 up and below 1e-4

    Calc sheets calc.js Every app
    64-bit
  • Size in millimeters

    The width and height of the copied area, on paper or at the drawing's real size.

    paper: mm = pixels × ptPerPx × (25.4 ÷ 72); real: mm = pixels × mmPerPx

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Render size in pixels

    The pixel width and height for an area given in points at a resolution, lowered so neither side passes the cap.

    d = dpi × min(1, maxPx ÷ (longer side × dpi ÷ 72)); w = round(wPt × d ÷ 72); h = round(hPt × d ÷ 72)

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Scale and turn from two points

    The scale, the angle and the point mapping that carry two points on the picture onto the two points where they belong.

    scale = |b₂ − b₁| ÷ |a₂ − a₁|; angle = atan2(b₂ − b₁) − atan2(a₂ − a₁); map(p) = b₁ + scale · R(angle) · (p − a₁)

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Box round a turned picture

    The width and height of the upright box round a picture turned by an angle.

    w′ = w·|cos θ| + h·|sin θ|; h′ = w·|sin θ| + h·|cos θ|

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    64-bit
  • Outline of an elliptical area

    The points of the ellipse that fits a box, used as the outline of a round copied area.

    pᵢ = (cx + rx·cos(2π·i ÷ n), cy + ry·sin(2π·i ÷ n)), n = 96

    Size of a copied area areaclip.js
    • CadCraft
    • BimCraft
    • MarkupCraft
    • DetailCraft
    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
  • Circle through a stroke

    The circle that best fits the stroke's points, with its root-mean-square error.

    u = x − x̄, v = y − ȳ; solve [Σu² Σuv; Σuv Σv²]·(u_c, v_c) = ½(Σu³ + Σuv², Σv³ + Σvu²); r² = u_c² + v_c² + (Σu² + Σv²) ÷ n

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • Turn of a stroke about a center

    How far the stroke goes round the fitted center, signed.

    Σ (aᵢ − aᵢ₋₁) with each step brought into (−π, π]

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • Squaring a direction

    Makes a direction level or plumb when it is within a few degrees of it.

    q = round(a ÷ (π ÷ 2)) × (π ÷ 2); used when |a − q| ≤ deg × π ÷ 180

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • Where two sides meet

    The corner where two straight sides cross.

    det = l × m; t = ((m₀ − l₀) × m) ÷ det; point = l₀ + l·t

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • Distance from a point to a segment

    How far a pen point is from the straight line between two others.

    t = ((p − a)·(b − a)) ÷ |b − a|², held to [0, 1]; distance = |p − (a + t(b − a))|

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • Straight sides and rectangles

    Cuts a stroke at its corners, squares each side, and rebuilds the corners where the sides cross.

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • A stroke as a line

    Makes a nearly straight stroke a line, exactly level or plumb when it is close to it.

    straight when max distance ≤ max(eps, 3.5 % of the gap) and gap > 90 % of the length

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • A stroke as a circle or an arc

    Makes a round stroke a circle, or an arc from the stroke's first point to its last.

    accepted when rms ÷ r < 0.07 and r < 3 × box diagonal; circle when |turn| > 0.85 × 2π

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • Joining loose ends

    Pulls each loose end onto the nearest corner of another stroke or of the drawing.

    nearest corner with distance ≤ tol; tol = 6 % of the sketch's box diagonal unless given

    Pen sketch cleanup sketch.js
    • CadCraft
    • MarkupCraft
    64-bit
  • Markups carried onto a revised sheet

    The points and rectangle of each markup on the new sheet, scaled when the new page has another size.

    k = min(w₂ ÷ w₁, h₂ ÷ h₁); p′ = origin₂ + (p − origin₁) × k

    Carried, stamped and pasted markup geometry slip.js
    • MarkupCraft
    64-bit
  • Superseded stamp position

    The rectangle of the Superseded stamp across the top middle of the old sheet.

    w = min(0.4 × page width as read, 432); h = max(36, 0.18 × w); rect = center ± half size

    Carried, stamped and pasted markup geometry slip.js
    • MarkupCraft
    64-bit
  • Picture size fitted to a box

    A picture's width and height scaled to fit a maximum size, keeping its proportions.

    k = min(maxW ÷ w, maxH ÷ h, 1e9); size = (w × k, h × k)

    Carried, stamped and pasted markup geometry imagestamp.js
    • MarkupCraft
    64-bit
  • Rectangle of a placed picture

    The rectangle of a picture of a given size centered on a point, turned with the page.

    rect = (cx − w ÷ 2, cy − h ÷ 2, cx + w ÷ 2, cy + h ÷ 2), with w and h swapped on a page turned 90° or 270°

    Carried, stamped and pasted markup geometry imagestamp.js
    • MarkupCraft
    64-bit
  • Box of copied page content

    The box around the selected objects that becomes the copied page's size.

    box = union of the objects' boxes, grown by max(line width ÷ 2 + 0.5) on every side

    Carried, stamped and pasted markup geometry content-clip.js
    • MarkupCraft
    64-bit
  • Transform of pasted content

    The matrix that moves copied content to where it is pasted and turns it to read the same way on the target page.

    T = translate(−cx, −cy) · R(turn) · translate(target); turn = (target rotation − source rotation) mod 360

    Carried, stamped and pasted markup geometry content-clip.js
    • MarkupCraft
    64-bit
  • Camera point and view scale

    The camera's X and Y over the markup and the size of the view, in meters.

    k = 0.0254 ÷ 72; cx = (x₀ + x₁) ÷ 2 × k; scale = 1.4 × max(Δx, Δy, 36) × k

    BCF viewpoint of a markup bcf.js
    • MarkupCraft
    64-bit
  • Paper sizes in points

    The width and height of each paper size in PDF points.

    inch = 72 points; mm = 72 ÷ 25.4 points; A4 = 210 mm × 297 mm

    Blank pages: paper sizes and grid blank.js
    • MarkupCraft
    64-bit
  • Grid lines and dots

    How many grid steps fit inside the margins and where each line or dot is drawn.

    n = floor((size − 2 × margin) ÷ pitch + 1e-6); start = (size − n × pitch) ÷ 2; line i = start + i × pitch

    Blank pages: paper sizes and grid blank.js
    • MarkupCraft
    64-bit
  • Old and new sheet mixed per pixel

    The color of each pixel of the compare picture, and counts of removed, added and unchanged pixels.

    Sheet compare picture compare.js
    • MarkupCraft
    32-bit, display only
  • Value of a number row

    The number handed to the app when a person changes a number box.

    v = min(max, max(min, typed value))

    Numbers typed into the property grid app-propgrid.js Every app
    64-bit
  • Rounding of a slider value

    Removes binary noise such as 0.30000000000000004 from a slider's value.

    v = round to (decimals of the step + 2) decimals, at most 8

    Numbers typed into the property grid app-propgrid.js Every app
    64-bit
  • Value of a slider row

    The number handed to the app while a slider is dragged or its box is changed.

    v = fix(clamp(value, min, max), step)

    Numbers typed into the property grid app-propgrid.js Every app
    64-bit
  • Integer or float

    Decides how a number is written.

    Numbers sent between people editing together live-client.js Every app
    64-bit
  • Writing a float

    Writes a number as 8 bytes.

    Numbers sent between people editing together live-client.js Every app
    64-bit
  • Writing an integer

    Writes a whole number in the shortest integer form that holds it.

    Numbers sent between people editing together live-client.js Every app
    Exact
  • Reading a float

    Reads a 4-byte or an 8-byte float from a message.

    Numbers sent between people editing together live-client.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.