PRECISION FOUNDRYSpend digits where they matter.

THE ROUNDING WORKSHOP

A few lost digits.
A very different result.

A value passes through three arithmetic stages. Each stage rounds its output to the significant digits you assign. Stay within the total digit budget and keep the final error under the tolerance.

Starting value
Reference result
Error tolerance
Digit budget

Significant digits count from the first nonzero digit. For example, 1000.12 needs six significant digits; 0.1234 needs four. Subtracting nearly equal large numbers can expose earlier rounding.

How the arithmetic is checked

Decimal.js computes operations at 60-digit precision, then rounds each stage to your chosen significant digits using ROUND_HALF_UP. The reference uses the same operations without those intermediate reductions. The budget is the lowest feasible total found by enumerating all allocations from2to10 digits per stage. You must decide where those digits belong.

Source: MikeMcl/decimal.js · MIT · 7,270 stars observed30October2026. Original digit-allocation challenges and GPT precision instrument art. License