Selecting denominator for relative error margins

123 Views Asked by At

When looking at this page: http://floating-point-gui.de/errors/comparison/

there are values a, and b that are being compared for being "nearly equal". It is shown that absolute error margin will not work for small values of a and b and that relative error margin should be used.

Namely, the site uses $abs(a-b)/b$, and that makes the operation not commutative. Why not use $abs(a-b)/a?$.

Is there a deeper meaning behind this? For example, can I use the average, something like $abs(a-b)/(abs(a+b)/2)$ instead?

Bonus: How do I interpret the result? Namely, answers are different if I select $a$, $b$, or $a+b\over2$ or $max(a,b)$ for denominator. Which one is right, or are they all "right", and this basically done for as long as we get a reasonably good relative error estimation in principle?

1

There are 1 best solutions below

0
On

I feel the same way: in general, a problem in which the parameters are treated symmetrically should have a result that uses them symmetrically.

In this case, I have used $\dfrac{|a-b|}{\max(a, b, 1)} $. It's not differentiable, but it does handle the switch between large and small $a$ and $b$ nicely, and it is symmetric in them.