# Relative error

The relative error of an interval in an edo is the interval's error in cents divided by the cents of an edostep, or equivalently stated, the error in relative cents.

For example, in 24-edo, 3/2 has an absolute error of about -2¢, meaning that the nearest interval in the edo is about 2¢ flat of 3/2. One edostep is 50¢, and -2 / 50 = -0.04, therefore the relative error is about -4% or -4 relative cents. In contrast, 12-edo has the same absolute error, but a smaller relative error of -2%. (In fact, 12-edo's absolute and relative errors are always identical.)

## Formula

The formula for closest mapping of any JI interval is

$e(n, r) = (\text{round} (n \log_2 r) - n \log_2 r) \times 100\%$

where n is the edo number and r is the targeted frequency ratio.

The unit of relative error is relative cent or percent.

With a direct mapping via the ratio's cents, the relative error ranges from -50% to +50%. With an indirect mapping via patent val or other val, it can be farther from zero. To obtain the relative error in patent val mapping, first find the relative errors of each prime, and then find the dot product of this vector with the ratio's monzo.

In indirect mapping, there are two additivities of relative errors.

First, for the same edo, a ratio which is the product of some other ratios have their relative errors additive, that is, if r3 = r1r2 for n, then e (n, r3) = e (n, r1) + e (n, r2).

Second, for the same ratio, an edo which is the sum of some other edos have their relative errors additive, that is, if n3 = n1 + n2 for r, then e (n3, r) = e (n1, r) + e (n2, r).

In either case, if the error exceeds the range -50% to +50%, it indicates that an inconsistency occurs, and there is a discrepancy in val mapping and direct mapping, so is the error. To find the error in closest mapping, modulo the previous result by 100%.

An example of the first additivity is shown as follows. The errors of 2/1, 3/1 and 5/1 in 19-edo are 0, -11.43% and -11.66%, respectively. Since 6/5 = (2/1)(3/1) / (5/1), its error is 0 + (-11.43%) - (-11.66%) = 0.23%. That shows 19-edo has fairly flat fifths and major thirds, yet they cancel out when it comes to minor thirds and results in a very accurate approximation.

Here is an example for the second additivity. The errors of 3/1 for 26-edo and 27-edo are -20.90% and +20.60%, respectively, and their sum -0.30% is the error of 3/1 for 53-edo.