Significant figures communicate what a measurement supports. They do not mean that every intermediate calculation should be rounded to the same number of digits, nor do extra digits on a screen create extra information. In code, this is a boundary problem: calculation values, uncertainty, and display strings are distinct data.
Think like a programmer
Keep full finite internal values and explicit uncertainty/precision metadata through calculations. Round only at a named presentation or external-export boundary. Make formatting a pure function whose rule and locale are recorded when a reported value matters. Test early versus late rounding on the same expression, but do not use significant-figure count as a replacement for uncertainty propagation or calibration evidence.
Model checklist
Inputs
Measured values, units, uncertainty or resolution, calculation expression, internal numeric precision, rounding/significant-figure rule, display locale, and reporting boundary.
Calculate using retained internal values; format a final result according to the stated evidence and rounding convention; preserve original measurement metadata.
Output
Machine value, report value/string, rounding difference, precision/uncertainty context, and provenance.
Check
Late rounding matches the full-precision calculation rounded once; early rounding differs for a selected sensitive fixture; adding displayed digits does not alter uncertainty metadata; unit conversion occurs before formatting; non-finite or ambiguous inputs are rejected or flagged.
Rounding error is not random measurement uncertainty. If a ruler has 1 mm resolution, carrying more binary floating-point digits through a calculation avoids compounding presentation error but does not make the ruler more accurate. Conversely, a low-precision display can hide a meaningful change if its rounding increment is larger than the effect being studied. State both the numerical/display rule and the measurement context.
For multiplication or division, introductory significant-figure rules are a reporting heuristic. For additive quantities, decimal-place alignment matters. For decisions requiring a confidence interval, use a measurement model and propagated uncertainty rather than counting digits. A repeated calculation with systematic bias can display many stable digits and still be wrong.
Rounding changes a program's state
Input
0.3333333333333333
Round first, then multiply by 3
0.99
Multiply first, then round
1.00
Try this experiment
Prediction: Early rounding creates a visible error at low precision, while showing more digits never improves the original measurement evidence.
Choose a calculation with several intermediate operations. Compare rounding at each step against rounding once at the end for one significant figure and for eight. Preserve the original unit and uncertainty beside both displays. Then change only the formatter and explain which fields are unchanged. Identify a case where uncertainty propagation—not a digit rule—would control the reported result.
Where this model breaks
Significant-figure rules are a reporting convention, not a full uncertainty calculation. Use propagated uncertainty when error bars matter to a decision. Floating-point representation, cancellation, ill-conditioned formulas, calibration error, systematic bias, and conversion constants can dominate the final reliability even when the output formatting is careful.
Summary
Calculate with retained internal values and preserve measurement metadata, then format once at a stated reporting boundary. Report only precision supported by evidence, and use an uncertainty model rather than digit counting when the decision requires it.
Glossary
Significant figure: a reported digit supported by measurement precision.
Intermediate value: a value used inside a calculation before final reporting.
Reporting boundary: point where a numeric value becomes a human/external representation.
Resolution: smallest distinguishable increment of an instrument or displayed quantity.
Self-check
When do you round a final result?
Does eight displayed digits imply eight measured digits?
What does early rounding change?
Why is a significant-figure rule not a complete uncertainty calculation?
Sources
NIST, Guide for the Use of the International System of Units (SI).
JCGM, Evaluation of Measurement Data.
Model contract
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
Quantities you set or measure, with units and useful bounds.
State
Values the program must retain to reproduce the next result.
Rule
The relationship or update that turns inputs and state into a result.
Check
A known limit, unit check, invariant, or measured result that can expose a bad model.
Implement the idea as a model
For Significant Figures and Rounding Errors, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Measurement, Units, and Uncertainty, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Guided experiment
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
Where this model breaks
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Summary
Treat Significant Figures and Rounding Errors as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Glossary
Input: a measured value or chosen parameter supplied to a model.
State: the smallest set of values needed to continue or reproduce a model.
Validation: comparing an output with a known result, limit, invariant, or measurement.
Self-check
Which values are inputs, and which values must remain state?
What observable result would tell you the model is behaving as expected?
Which assumption would you test first before applying the model to a real system?
Model review: turn Significant Figures and Rounding Errors into a test
See why measurement precision and display rounding are different decisions in a physics calculation.
Name the inputs and units that the measurement, units, and uncertainty model needs.
Separate the state you must keep from values you can calculate when needed.
Write one rule that maps the current state and inputs to an observable result.
Choose a limiting case, unit check, invariant, or known result before trusting an output.
State one assumption you would change before using this simplified model for a real decision.