# Do you round uncertainties in intermediate calculations?

Let's say I have an experimental uncertainty of ±0.03134087786 and I perform many uncertainty calculations using this value. Should I round the uncertainty to 1 significant figure at this stage or leave it unrounded until my final answer?

tl;dr- No, rounding numbers introduces quantization error and should be avoided except in cases in which it's known known to not cause problems, e.g. in short calculations or quick estimations.

# No: Don't round in intermediate calculations

Rounding values introduces quantization error (e.g., round-off error). Controlling for the harmful effects of quantization error is a major topic in some fields, e.g. computational fluid dynamics (CFD), since it can cause problems like numerical instability. However, if you're just doing a quick estimation with a calculator or for a quick lab experiment, quantization error can be acceptable. But, to stress it – it's merely acceptable in some cases; it's never a good thing that we want.

This can be confusing because many intro-level classes teach the method of significant figures, which calls for rounding, as a basic method for tracking uncertainty. And in non-technical fields, there's often a rule that estimated values should be rounded, e.g. a best guess of "103 days" might be stated as "100 days". In both cases, the issue is that a reader might mistake the apparent precision of an estimate to imply a certainty that doesn't exist.

Such problems are purely communication issues; the math itself isn't served by such rounding. For example, if a best guess is truly "103 days", then presumably it'd be best to actually use that number rather than arbitrarily biasing it; sure, we might want to adjust an estimate up-or-down for other reasons, but making an intermediate value look pretty doesn't make any sense.

### Getting digits back after rounding

Often, publications use a lot of rounding for largely cosmetic reasons. Sometimes these rounded values reflect an approximate level of precision; in others, they're almost arbitrarily selected to look pretty.

While these cosmetic reasons might make sense in a publication, if you're doing sensitive work based on another author's reported values, it can make sense to email them to request the additional digits or/and a finer qualification of their precision.

For example, if another researcher measures a value as "$1.235237$" and then publishes it as $1.2"$ because their uncertainty is on-the-order-of $0.1$, then presumably the best guess one can make is that the "real" value is distributed around $1.235237$; using $1.2$ on the basis of it looking pretty doesn't make any sense.

### Uncertainties aren't special values

The above explanations apply to not just a base measurement, but also to a measurement's uncertainty. The math doesn't care for a distinction between them.

So for grammatical reasons, it's common to write up an uncertainty like ${\pm}0.03134087786$ as ${\pm}0.03"$; however, no one should be using ${\pm}0.03$ in any of their calculations unless they're just trying to do a quick estimate or otherwise aren't too concerned with accuracy.

In summary, no, intermediate values shouldn't be rounded. Rounding is best understood as a grammatical convention to make writing look pretty rather than being a mathematical tool.

### Examples of places in which rounding is problematic

A general phenomena is loss of significance:

Loss of significance is an undesirable effect in calculations using finite-precision arithmetic such as floating-point arithmetic. It occurs when an operation on two numbers increases relative error substantially more than it increases absolute error, for example in subtracting two nearly equal numbers (known as catastrophic cancellation). The effect is that the number of significant digits in the result is reduced unacceptably. Ways to avoid this effect are studied in numerical analysis.

"Loss of significance", Wikipedia

The obvious workaround is then to increase precision when possible:

### Workarounds

It is possible to do computations using an exact fractional representation of rational numbers and keep all significant digits, but this is often prohibitively slower than floating-point arithmetic. Furthermore, it usually only postpones the problem: What if the data are accurate to only ten digits? The same effect will occur.

One of the most important parts of numerical analysis is to avoid or minimize loss of significance in calculations. If the underlying problem is well-posed, there should be a stable algorithm for solving it.

"Loss of significance", Wikipedia

A specific example is in Gaussian elimination, which has a lot of precision-based problems:

One possible problem is numerical instability, caused by the possibility of dividing by very small numbers. If, for example, the leading coefficient of one of the rows is very close to zero, then to row reduce the matrix one would need to divide by that number so the leading coefficient is 1. This means any error that existed for the number which was close to zero would be amplified. Gaussian elimination is numerically stable for diagonally dominant or positive-definite matrices. For general matrices, Gaussian elimination is usually considered to be stable, when using partial pivoting, even though there are examples of stable matrices for which it is unstable.

"Gaussian elimination", Wikipedia [references omitted]

Besides simply increasing all of the values' precision, another workaround technique is pivoting:

### Partial and complete pivoting

In partial pivoting, the algorithm selects the entry with largest absolute value from the column of the matrix that is currently being considered as the pivot element. Partial pivoting is generally sufficient to adequately reduce round-off error. However, for certain systems and algorithms, complete pivoting (or maximal pivoting) may be required for acceptable accuracy.

"Pivot element", Wikipedia

• OP isn't asking about rounding on values, but on the uncertainties themselves. – Emilio Pisanty Apr 12 '18 at 9:25
• @EmilioPisanty Because the OP's using the uncertainties in calculations, it'd seem that the same logic applies to them. Am I missing something? – Nat Apr 12 '18 at 9:32
• Rewrote the above a bit to be clearer. Kinda took this topic as a chance to stress deprogramming of some of the bad habits introduced in early classes. I mean, the method of significant figures is a very helpful tool for intro-level work and for quick approximations, though I haven't really seen it stressed enough that it's a simplified intro tool and not something that people should take too seriously. – Nat Apr 14 '18 at 22:49
• For anyone who wants to look into this more, the tl;dr is that most measurements are basically distributions (rather than precise values), so it's most correct to do distribution math. For a gentle introduction, the videos for an Excel add-in, "Analytic Solver Simulation", show how to get all Monte-Carlo about uncertainty calculations. When a single uncertain value is used in calculations, it should be understood that the work's doing fuzzy math - which is a shortcoming that might be tolerated, but not an ideal to shoot for. – Nat Apr 14 '18 at 22:53
• No, this is wrong. Any calculation you do on a calculator or computer is rounded, so it doesn't even make sense to say "don't round." – Ben Crowell Apr 14 '18 at 23:58

EDIT - As noted by Ben Crowell in the comments, my original answer here is not correct. Standard practice to reduce rounding error is to keep one (or two, if you want to be safe) extra digits in intermediate calculations. The intermediate uncertainty should certainly not have 10 significant figures, but 2 or 3 would be appropriate for safety.

Round it. The fact of the matter is that anything after the first (or arguably second) significant figure in an uncertainty estimate is meaningless. If you're uncertain of the value of the third digit after the floating point, then you obviously have no idea of the value of the eighth.

In Taylor's Introduction to Error Analysis, he writes

Several basic rules for stating uncertainties are worth emphasizing. First, because the quantity $\delta x$ is an estimate of an uncertainty, obviously it should not be stated with too much precision. If we measure the acceleration of gravity $g$, it would be absurd to state a result like $$\text{(measured g)} = 9.82 \pm 0.02385 \text{ m/s}^2$$The uncertainty in the measurement cannot conceivably be known to four significant figures. In high-precision work, uncertainties are sometimes stated with two significant figures, but for our purposes we can state that [experimental uncertainties should almost always be rounded to one significant figure].

[...] The rule has one significant exception. If the leading digit in the uncertainty $\delta x$ is a 1, then keeping two significant figures in $\delta x$ may be better. For example, suppose that some calculation gave the uncertainty $\delta x = 0.14$. Rounding this number to $\delta x = 0.1$ would be a substantial proportionate reduction, so we could argue that retaining two figures might be less misleading, and quote $\delta x = 0.14$. The same argument could perhaps be applied if the leading digit is a 2 but certainly not if it is any larger.

If you aren't familiar with the book, it's an outstanding resource for understanding how experimental errors propagate through calculations, and the meaning behind the statistical analysis that often gets left out of experimental science courses.

• The uncertainty in $x^2$ is not $(\delta x)^2$, it is $2\overline x \delta x$, where $\overline x$ is the mean measured value of $x$. I'm not sure what you mean by the rest of your comment, could you explain what troubles you about this procedure? – J. Murray Apr 8 '18 at 19:50
• I'll give you an example. Let's say I measure ten oscillations and get a total time of $7.6 \pm 0.2 \ s$. I would then calculate the time of a single oscillation to be $0.76 \pm 0.02 \ s$. The uncertainty in the square of the period is given by $\delta (T^2) = 2 \overline{T} \delta T = 2(0.76)(0.02) = 0.0304 \approx 0.03$. Additionally, $\overline{T^2} = \left(\overline{T}\right)^2 = (0.76)^2 = 0.5776 \ s$, and based on the uncertainty I just calculated, I would round this to $0.58 \ s$. – J. Murray Apr 8 '18 at 20:08
• So the reported quantity would be $T^2 = 0.58 \pm 0.03 \ s^2$. – J. Murray Apr 8 '18 at 20:09
• This is wrong. We don't round severely at intermediate steps, because rounding errors can accumulate. The OP isn't asking about how many sig figs to use at the end (which is what the quoted material is talking about), they're asking about an intermediate step. Typically one retains one or two insignificant figures at intermediate steps. – Ben Crowell Apr 8 '18 at 21:21
• @BenCrowell Yes, you're right. I was a bit hasty with my answer, and have added this edit at the top. – J. Murray Apr 8 '18 at 21:50