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

  • Summary of the comparison

    The counts, the largest horizontal and height differences and the root mean square of the horizontal differences.

    rms = √(Σ dh² ÷ n)

    Layout point files and as-built comparison layout/layout-points.js
    • CadCraft
    • BimCraft
    64-bit
  • Comparison table

    The rows of the comparison as text for the page and the CSV.

    text = v.toFixed(3)

    Layout point files and as-built comparison layout/layout-points.js
    • CadCraft
    • BimCraft
    64-bit
  • Add, subtract, multiply, divide

    The four arithmetic functions on integers and reals.

    all integers: 32-bit result; any real: 64-bit result; integer ÷ integer truncates toward zero

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • FIX: a real to an integer

    Drops the fraction of a number.

    int(trunc(x))

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • Math.sqrt, Math.exp, Math.log, Math.pow

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • EQUAL with a fuzz

    Whether two numbers or lists of numbers are equal within a given amount.

    |a − b| ≤ fuzz

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • RTOS: a number as text

    Formats a length in decimal or in the drawing's other length formats.

    decimal: v.toFixed(prec); 0 when |v| < 0.5 × 10⁻ᵖʳᵉᶜ

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • ANGTOS: an angle as text

    Formats an angle in degrees, degrees-minutes-seconds, grads, radians or surveyor's bearings.

    degrees = a × 180 ÷ π; grads = a × 200 ÷ π; minutes = (deg − whole) × 60

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • ANGTOF: text to an angle

    Reads an angle written in any of the angle formats and returns radians.

    degrees × π ÷ 180; d + m ÷ 60 + s ÷ 3600; grads × π ÷ 200

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • Unit factors for CVUNIT

    The factor of each unit to its base unit: meter, radian, kilogram or square meter.

    inch 0.0254; foot 0.3048; yard 0.9144; mile 1609.344; pound 0.45359237; sq inch 0.00064516; sq foot 0.09290304; acre 4046.8564224

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • CVUNIT: convert between units

    Converts a number or a list of numbers from one unit to another of the same kind.

    result = v × from ÷ to

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • POLAR, DISTANCE and ANGLE

    A point at an angle and distance from another, the distance between two points, and the angle of the line between them.

    q = p + d (cos a, sin a); dist = √(Δx² + Δy² + Δz²); angle = atan2(Δy, Δx) into 0 to 2π

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • INTERS: where two lines meet

    The intersection of two lines or segments given by their end points.

    den = Δ₁ × Δ₂; u = ((p₃ − p₁) × Δ₂) ÷ den; q = p₁ + u Δ₁

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • ATOI and ATOF: text to a number

    Reads the leading whole number or real number of a text.

    parseInt or parseFloat of the leading number

    LISP arithmetic, conversions and geometry lisp/builtins.js
    • CadCraft
    64-bit
  • A routine's number as command input

    Turns a number a routine gives to a command into the text the command reads.

    text = String(+v.toPrecision(15))

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • Answers to a command's prompts

    Hands a routine's string, number, point or object to the command that is waiting for input.

    point: UCS to world, then given as a click; number: as 15-digit text

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • Block-to-world matrix of a nested pick

    The transform from a block's own coordinates to the drawing for an object picked inside nested block references.

    M = M · [rotation × scale, insertion − base]; pick in block = M⁻¹ · pick

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • TRANS: between coordinate systems

    Converts a point or a direction between the world, the user coordinate system and the display.

    display: turn by the view's twist; UCS: by the active coordinate system (ucs.js)

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • Current lineweight as a system variable

    The current lineweight in hundredths of a millimeter.

    CELWEIGHT = round(lineweight × 100)

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • Drawing extents as system variables

    EXTMIN and EXTMAX: the box around every object.

    min and max of every object's bounds

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • Date as a Julian day number

    The DATE system variable.

    Julian date = milliseconds since 1970 ÷ 86 400 000 + 2 440 587.5

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • Position of a block attribute

    The world position of an attribute of a block reference, as entget reports it.

    p = insertion + R(rot) · ((d − base) × scale)

    Drawing values handed to and from LISP routines lisp/host-cad.js
    • CadCraft
    64-bit
  • Angles brought into 0 to 2π

    Normalizes an arc's, text's or block reference's angle for a data list, and when a routine writes one back.

    a′ = ((a mod 2π) + 2π) mod 2π

    Drawing values handed to and from LISP routines lisp/dxflist.js
    • CadCraft
    64-bit
  • Lineweight in a data list

    An object's lineweight as group 370, in hundredths of a millimeter.

    370 = round(lw × 100)

    Drawing values handed to and from LISP routines lisp/dxflist.js
    • CadCraft
    64-bit
  • Lineweight from a data list

    Sets an object's lineweight in millimeters from group 370.

    lw = value ÷ 100

    Drawing values handed to and from LISP routines lisp/dxflist.js
    • CadCraft
    64-bit
  • Arc from a data list

    Makes or changes an arc from its center, radius and two angles.

    center, radius as given; angles into 0 to 2π

    Drawing values handed to and from LISP routines lisp/dxflist.js
    • CadCraft
    64-bit
  • Viewport scale from a data list

    Sets a layout viewport's scale from the view height a routine gives.

    scale = paper height ÷ view height

    Drawing values handed to and from LISP routines lisp/dxflist.js
    • CadCraft
    64-bit
  • Linetype pattern length

    The total length of a linetype's dashes and gaps in its table record.

    length = Σ |xᵢ|

    Drawing values handed to and from LISP routines lisp/dxflist.js
    • CadCraft
    64-bit
  • Length and angle of a line

    The Length, Angle and Delta properties of a line.

    length = √(Δx² + Δy²); angle = atan2(Δy, Δx) into 0 to 2π

    Drawing values handed to and from LISP routines lisp/vla-host.js
    • CadCraft
    64-bit
  • Circle and arc properties

    Diameter, area and circumference of a circle; total angle, arc length and end points of an arc.

    area = π r²; circumference = 2π r; sweep = ((a₁ − a₀) mod 2π + 2π) mod 2π; arc length = r × sweep; end = c + r (cos a, sin a)

    Drawing values handed to and from LISP routines lisp/vla-host.js
    • CadCraft
    64-bit
  • Ellipse radii

    The major and minor radius of an ellipse.

    major = √(m_x² + m_y²); minor = major × ratio

    Drawing values handed to and from LISP routines lisp/vla-host.js
    • CadCraft
    64-bit
  • Lineweight property set by a routine

    Sets an object's lineweight in millimeters from a value in hundredths of a millimeter.

    lw = value ÷ 100

    Drawing values handed to and from LISP routines lisp/vla-host.js
    • CadCraft
    64-bit
  • Plane of a face

    The plane a face lies in, as a unit normal and a distance from the origin.

    n = Newell normal of the outer loop; d = n · p₀

    Face planes, areas, triangles and solid volume m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Area of a face

    The area of a face, holes taken out.

    area = |Σ (pᵢ × pᵢ₊₁)| ÷ 2 for the outer loop, minus the same for each hole

    Face planes, areas, triangles and solid volume m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Triangles of a face

    The triangles a face is cut into for volume, export and ray tests.

    Face planes, areas, triangles and solid volume m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Surface area and volume of a shape

    Whether a group or component is closed, its total face area and, when closed, its volume.

    V = Σ a · (b × c) ÷ 6 over all triangles; A = Σ face areas

    Face planes, areas, triangles and solid volume m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Vertex at a point

    The vertex a drawn point becomes: an existing one, or a new one that splits the edge it lands on.

    s = (p − A) · u ÷ (u · u); on the edge when 0 < s < 1 and |A + s·u − p| ≤ EPS

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Stops along a new edge

    Where a new edge is cut by the vertices and edges it meets.

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Crossing of two edges

    The point where two edges cross inside both of them.

    n = u × w; s = ((C − A) × w) · n ÷ (n · n); t = ((C − A) × u) · n ÷ (n · n)

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Planes a new edge may close a face on

    The planes tried when a new edge might complete a face.

    n = u × (C − A), kept when |n| > 1e-9 × |u| × |C − A|

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Faces of a plane from its edges

    Which closed loops of edges on a plane are faces, which are holes, and which side each face shows.

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Loops of the planar edge graph

    The closed loops formed by the edges on a plane, and the signed area of each.

    edges round a vertex sorted by atan2(Δy, Δx); area = ½ Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Point inside a loop

    Whether a 2D point is inside a loop, used to match holes and old faces.

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Test point inside a region

    A point well inside a region, used to ask which old faces cover it.

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Welding coincident vertices

    Merges vertices at the same place and removes edges and loops that collapse.

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Removing a vertex on a straight run

    Joins two edges that continue each other in a straight line into one.

    merged when u₁ · u₂ ≤ −1 + 1e-9

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Merging coplanar faces

    Removes an edge between two faces that lie in one plane and face the same way.

    n₁ · n₂ ≥ 1 − 1e-9 and |d₁ − d₂| ≤ EPS

    Drawing an edge: welding, splitting and re-facing m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Push or pull a face

    Moves a face along its normal by a typed or dragged distance, or extrudes it into side faces.

    p′ = p + n × distance

    Push/pull, move, stretch, follow me and intersect m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Depth to the face behind

    How far a face can be pushed in before it meets the first face behind it.

    smallest ray parameter t > EPS along −n

    Push/pull, move, stretch, follow me and intersect m3d/model.js
    • CadCraft
    • ModelCraft
    64-bit
  • Moving vertices by a matrix

    The new place of each selected vertex under a move, rotate, scale or flip.

    p′ = M · p

    Push/pull, move, stretch, follow me and intersect m3d/model.js
    • CadCraft
    • ModelCraft
    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.