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

  • Series coefficients

    The factors 1/n! of the sine and cosine series.

    cₙ = ±1 ÷ n!

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Angle reduction

    Brings an angle into [−π, π].

    n = floor(x ÷ 2π + ½); r = (x − n × 2π_hi) − n × 2π_lo

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Sine series

    The sine of a reduced angle.

    sin r = r(c₀ + c₁r² + … + c₁₂r²⁴)

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Cosine series

    The cosine of a reduced angle.

    cos r = c₀ + c₁r² + … + c₁₂r²⁴

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Sine

    sin x for any finite x.

    sin r = sin(π − r) for r > π/2; sin r = sin(−π − r) for r < −π/2

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Cosine

    cos x for any finite x.

    cos r = −cos(π − |r|) for |r| > π/2

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Exponential

    The exponential eˣ of a number.

    k = floor(x ÷ ln 2 + ½); r = (x − k × ln2_hi) − k × ln2_lo; eˣ = 2ᵏ × Σ rⁿ ÷ n! (n = 0 … 18)

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Natural logarithm

    The natural logarithm ln x of a number.

    x = m × 2ᵉ, m in [√2/2, √2]; ln m = 2(s + s³/3 + … + s²⁹/29), s = (m − 1) ÷ (m + 1); ln x = e × ln2_hi + (ln m + e × ln2_lo)

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Base-2 logarithm

    The base-2 logarithm log₂ x of a number.

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Base-10 logarithm

    The base-10 logarithm log₁₀ x of a number.

    log₁₀ x = ln x ÷ 2.302585092994046

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Whole-number power

    xⁿ for a whole n ≥ 0.

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Power

    A number x raised to a power y.

    xʸ = exp(y × ln x) for a fractional y

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Arctangent

    The arctangent atan x of a number.

    atan z = 2·atan(z ÷ (1 + √(1 + z²))), twice; then 4(z − z³/3 + … + z⁴¹/41)

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Two-argument arctangent

    The angle of the point (x, y).

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Arcsine

    The arcsine asin x of a number in [−1, 1].

    asin x = atan2(x, √((1 − x)(1 + x)))

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Arccosine

    The arccosine acos x of a number in [−1, 1].

    acos x = 2·atan2(√(1 − x), √(1 + x))

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Tangent

    The tangent tan x of an angle.

    tan x = sin x ÷ cos x

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Hyperbolic sine

    The hyperbolic sine sinh x of a number.

    sinh x = (eˣ − e⁻ˣ) ÷ 2

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Hyperbolic cosine

    The hyperbolic cosine cosh x of a number.

    cosh x = (eˣ + 1 ÷ eˣ) ÷ 2

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Hyperbolic tangent

    The hyperbolic tangent tanh x of a number.

    tanh x = (e²ˣ − 1) ÷ (e²ˣ + 1)

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Cube root

    The cube root ∛x of a number.

    r₀ = exp(ln|x| ÷ 3); r ← r − (r³ − |x|) ÷ (3r²), twice

    Deterministic sine, cosine, exp, log and power field/detmath.js
    • PartCraft
    64-bit
  • Sphere

    Signed distance to a sphere.

    d = √((x − cx)² + (y − cy)² + (z − cz)²) − r

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Box with rounded edges

    Signed distance to a box, optionally with rounded edges and corners.

    q = |p − c| − (half − round); d = |max(q, 0)| + min(max(q_x, q_y, q_z), 0) − round

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Cylinder

    Signed distance to a cylinder between two points.

    t = (p − m)·u; d_r = |p − m − t·u| − r; d_t = |t| − L ÷ 2; d = |max(d_r, d_t, 0)| + min(max(d_r, d_t), 0)

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Torus

    Signed distance to a torus about the z axis.

    d = √((√(x² + y²) − R)² + z²) − r

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Half space

    Signed distance to a plane.

    d = (n·p − d₀) ÷ |n|

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Solid of revolution

    Signed distance to the solid under a profile r(x) turned about the x axis.

    ρ = √(y² + z²); d = least distance from (x, ρ) to the profile's segments; inside when ρ ≤ r(x)

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Union, intersection and subtraction

    Combines shapes by union, intersection or subtraction.

    union = min(a, b); intersection = max(a, b); subtraction = max(a, −b)

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Smooth minimum

    Blends two shapes with a radius k.

    h = clamp(½ + (b − a) ÷ 2k, 0, 1); s = b + (a − b)h − k·h(1 − h)

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Offset and shell

    Grows or shrinks a shape, or hollows it to a wall thickness.

    offset: d − δ; shell inward: max(d, −d − t); shell centered: |d| − t ÷ 2

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Move, turn and scale

    A shape under a rigid motion and a uniform scale.

    q = Rᵀ(p − move) ÷ s; d = d₀(q) × s

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Rotation matrix

    The 3 × 3 matrix of a turn about an axis by an angle.

    R = c·I + s·[u]ₓ + (1 − c)·u uᵀ, c = cos θ, s = sin θ

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Beam or round cone

    Signed distance to a beam whose radius changes from one end to the other.

    t = clamp((p − a)·(b − a) ÷ |b − a|², 0, 1); d = |p − a − t(b − a)| − (r₀ + (r₁ − r₀)t)

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Lattice of beams

    The least distance to many beams.

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Ramped cell size and wall

    A number that changes linearly along an axis or with radius.

    v = v₀ + (v₁ − v₀) × clamp((p − a) ÷ (b − a), 0, 1)

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Phase of a graded lattice

    Maps a point to the lattice's own period coordinates when the cell size changes.

    fixed cell: X = 2π·p ÷ cell; ramp: X = ∫k dp with k linear in p

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Gyroid, Schwarz P and diamond

    Signed distance to a triply periodic minimal surface, as a sheet or a network.

    d ≈ g ÷ |∇g|; near the surface: two projections q ← q − g∇g ÷ |∇g|², d = ±|p − q|

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Brick classification

    Decides whether a ball of space is wholly outside, wholly inside or near the surface.

    outside when f − L·r > band; inside when f + L·r < −band

    Field shapes: signed distance functions field/field.js
    • PartCraft
    64-bit
  • Bricks to compute

    Which bricks of the lattice can hold the surface.

    brick range = floor((box ∓ band × h) ÷ h ÷ 8); ball radius = 3.5√3 × h

    Distance grid: baking, sampling and volume field/bake.js
    • PartCraft
    64-bit
  • Node values of a brick

    The signed distance at each of a brick's 512 nodes.

    value = clamp(f(i·h, j·h, k·h), −band × h, band × h)

    Distance grid: baking, sampling and volume field/bake.js
    • PartCraft
    32-bit in part
  • Brick key

    One whole number that names a brick.

    key = ((bx + 65536) × 131072 + (by + 65536)) × 131072 + (bz + 65536)

    Distance grid: baking, sampling and volume field/grid.js
    • PartCraft
    Exact
  • Value at a point

    The signed distance at any point, between the lattice nodes.

    trilinear: a + (b − a) × t along x, then y, then z

    Distance grid: baking, sampling and volume field/grid.js
    • PartCraft
    32-bit in part
  • Gradient at a point

    The direction and rate of change of the distance.

    g = (f(p + h/2) − f(p − h/2)) ÷ h, per axis

    Distance grid: baking, sampling and volume field/grid.js
    • PartCraft
    32-bit in part
  • Box of the stored bricks

    The world box that holds every stored node.

    lo = brick × 8 × h; hi = (brick × 8 + 7) × h

    Distance grid: baking, sampling and volume field/grid.js
    • PartCraft
    64-bit
  • Enclosed volume

    The volume inside the surface.

    V = h³ × Σ clamp(½ − d ÷ h, 0, 1)

    Distance grid: baking, sampling and volume field/grid.js
    • PartCraft
    32-bit in part
  • Welding corners

    Merges mesh corners that sit at the same position.

    Distance grid: baking, sampling and volume field/mesh-sdf.js
    • PartCraft
    64-bit
  • Angle-weighted normals

    The pseudo-normal at each corner and edge, used for the sign.

    angle = acos(e₁·e₂ ÷ (|e₁||e₂|)); N_vertex = Σ angle × n_face

    Distance grid: baking, sampling and volume field/mesh-sdf.js
    • PartCraft
    64-bit
  • Signed distance at a node

    The distance from a lattice node to the mesh, negative inside.

    d = √(least squared distance); sign = sign((p − closest)·N)

    Distance grid: baking, sampling and volume field/mesh-sdf.js
    • PartCraft
    32-bit in part
  • Closest point on a triangle

    The nearest point of a triangle to a point, and which face, edge or corner it lies on.

    Distance grid: baking, sampling and volume field/mesh-sdf.js
    • PartCraft
    64-bit
  • Inside or outside far from the surface

    Marks bricks no triangle comes near as inside or outside.

    x_cross = (w₀a_x + w₁b_x + w₂c_x) ÷ (w₀ + w₁ + w₂); inside when an odd number of crossings lie before the brick

    Distance grid: baking, sampling and volume field/mesh-sdf.js
    • 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.