Definition
Resolution, precision and accuracy are three different properties of a measurement. Resolution is the smallest change in the measured quantity that changes the reading. Precision is how closely repeated readings of the same quantity, taken under stated conditions, agree with one another. Accuracy is how closely a reading agrees with the true value of the quantity. The difference that matters: a measurement can have fine resolution and high precision while every reading is far from the true value, so neither property shows accuracy.
The idea
A program times an operation with a clock that returns a 64-bit count of nanoseconds, and whose counter really does advance once per nanosecond. A reference instrument confirms that the operation takes exactly 1 second. Repeated runs agree with one another to within a few nanoseconds, yet every reading is about 1 millisecond too long, because the inexpensive on-chip oscillator that drives the counter runs 0.1% fast. The readings are fine-grained, repeatable and wrong.
The usual picture is a target. Precision is how tightly the shots group; accuracy is how close they land to the center. A tight group far from the center is precise but not accurate. Coarse resolution is like recording each hit only by the ring it lands in, so that its position inside the ring is lost. The picture stops at the center: the center of a target is known exactly, whereas a real reference value carries its own error.
Behind the picture is a split of every error into two parts. The systematic error, also called bias, is the part that is the same in every reading taken under the same conditions: here, the 1 millisecond per second added by the fast oscillator. The random error is the part that changes from reading to reading: here, a few nanoseconds of scatter. Precision describes only the random part; accuracy needs both parts to be small. Averaging many readings shrinks the random part and leaves the bias untouched, so only a comparison with a reference can reveal a bias.
How it works
Each property has its own cause and its own test.
Resolution is set by the step of the instrument. For a clock the step is the tick, the time between two increments of the counter behind the clock. A counter driven at 32,768 hertz (increments per second) has a tick of second, about 30.5 microseconds, even when a library function converts its count to nanoseconds. To test the resolution, read the clock many times in a tight loop: the smallest nonzero difference between consecutive readings is the tick or the time one reading takes, whichever is larger. On Unix-like systems the POSIX (Portable Operating System Interface) function
clock_getresreports the resolution the system claims for a clock.Precision is set by random variation, such as interrupts §6.11 that delay the moment the clock is read. To test it, repeat the measurement under stated conditions and compute the standard deviation §11.14 of the readings, a measure of their typical distance from their mean. The smaller the standard deviation, the higher the precision.
Accuracy depends on both the random and the systematic error. A clock’s systematic errors include an oscillator that runs fast or slow, so that the clock gains or loses time steadily (clock drift §6.18); an offset from true time; timestamps taken at the wrong moments; and a fixed cost of reading the clock. To test accuracy, compare the readings with a reference whose own error is known and much smaller. Comparing with a reference and correcting for the difference is called calibration §11.42.
A precision figure needs its conditions. Repeats on one board within one minute, called repeatability conditions §11.43, usually scatter less than repeats on different boards, days or temperatures, called reproducibility conditions. The three definitions follow the International Vocabulary of Metrology, the reference dictionary of measurement terms, which calls the closeness of the long-run average of the readings to the true value trueness.
Worked example
Three runs of the 1-second operation report 1,001,000,012, 1,001,000,009 and 1,001,000,015 nanoseconds, against a true duration of 1,000,000,000 nanoseconds. The counter advances once per nanosecond, so the resolution is 1 nanosecond. Write each reading as 1,001,000,000 plus a remainder; the remainders are 12, 9 and 15 nanoseconds.
Precision. The mean of the remainders is , so the mean reading is 1,001,000,012 nanoseconds. The deviations from the mean are , and . Their squares sum to . Dividing by , where is the number of readings, gives 9, and the square root of 9 gives a standard deviation of 3 nanoseconds.
Accuracy. The error of the mean reading is nanoseconds, about 1 millisecond. Of that, 1,000,000 nanoseconds is the rate error: 0.1% of 1,000,000,000. The other 12 nanoseconds are too large to be random scatter, because the standard error §11.15 of a mean of three readings, the standard deviation divided by , is only nanoseconds. They are a second systematic error, such as the fixed cost of reading the clock. Calibration against the reference finds both errors: dividing by 1.001 and subtracting 12 nanoseconds gives nanoseconds.
Coarse resolution. A second clock function also returns nanoseconds but is updated only once per 1-millisecond operating-system tick, so every value it returns is a multiple of 1,000,000 nanoseconds. An operation that lasts 0.3 millisecond and starts just after a tick ends before the next tick and reads as 0. Twenty such runs all read 0. That spread of zero looks like perfect precision, but it only shows that the variation is smaller than the 1-millisecond resolution.
Stated precisely
Let be the true value of the measured quantity, and let be readings of it taken under stated conditions. The error of reading is , which the usual error model writes as where the bias is the same for every reading under those conditions, and the random error varies from reading to reading with long-run average 0 and standard deviation .
Resolution : the readings take only values a step apart, so a change in smaller than need not change the reading. Rounding to the nearest step adds at most to the error of a single reading.
Precision is described by , which is estimated from the readings by
Trueness is described by , the size of the bias.
Accuracy concerns the whole error. Write for the long-run average of a quantity . Because , the root-mean-square error is
The mean of readings has error , where is the average of the random errors. If the random errors are independent, the standard deviation of is , so averaging shrinks the random part toward 0 and leaves unchanged. In the example, nanoseconds and nanoseconds, so the root-mean-square error is nanoseconds: the bias is essentially the whole error. These statements assume a bias that stays constant under the stated conditions (for example, an oscillator whose rate does not change with temperature during the runs), random errors that are independent of one another, and a reference value known with an error much smaller than the errors studied.
Limits and common mistakes
Digits are not resolution. A 64-bit count of nanoseconds, or a floating-point number §4.49 with 15 significant digits, says how finely a value is written, not how finely the instrument tells values apart. Printing more decimal places changes none of the three properties.
In computing, “precision” also means the number of digits a number format holds, as in double-precision floating point. That meaning describes the representation of a number and is closer to resolution than to the measurement meaning.
Zero spread does not show high precision. When the random variation is smaller than the resolution, every reading falls on the same step, and the true value is known only to within about one step.
A clock’s datasheet usually states its accuracy as a bound on its rate error in parts per million (ppm). A 20-ppm oscillator can gain or lose up to seconds per day. The time error from a rate error grows in proportion to the interval measured, so it dominates long intervals, while resolution and the cost of reading the clock dominate short ones.
Accuracy belongs to the whole measurement method, not to the clock alone: where the timestamps are taken, what the interval includes and the time added by the measurement itself (instrumentation overhead §11.32) all enter the error. State accuracy as a number, such as an error bound or a measurement uncertainty §11.33, not as the word “accurate”.
Questions answered
Can a nanosecond-valued clock be inaccurate by milliseconds?
Yes. A clock that reports time in nanoseconds can be wrong by milliseconds, because the unit of its value fixes only how finely the value is written. The unit says nothing about the clock’s resolution (the smallest change that alters its reading), its precision (how closely repeated readings agree) or its accuracy (how close its readings are to true time). Common causes of millisecond errors are a counter that advances only once per 1-millisecond operating-system tick, so that every value is a multiple of 1,000,000 nanoseconds; an oscillator that runs 0.1% fast, which adds 1 millisecond to every second measured; a wall clock §9.36, set to calendar time, that is milliseconds away from true time after synchronization over a network; and timestamps taken at the wrong moments.
Repeated readings can agree to within a few nanoseconds and still share the same millisecond error, because a systematic error is the same in every reading and averaging does not remove it. Only calibration, a comparison with a reference whose own error is known, establishes how accurate the clock is.
Related entries: Measurement uncertainty (§11.33), Counter quantization (§11.35), Calibration (§11.42), Reproducibility versus repeatability (§11.43), Variance and standard deviation (§11.14), Clock source and drift (§6.18).