Relative difference

From Wikipedia, the free encyclopedia

The relative difference of two numbers is their absolute difference divided by the maximum of the two numbers. The relative difference is a unitless number expressed as a percentage.


d_r=|x-y|/\max(|x|,|y|)\,

for at least one of the values not equal zero.

It is especially useful when comparing floating point values in programming languages for equality with a certain tolerance[1]

Another application is in the computation of approximation errors when the relative error of a measurement is required.

[edit] See also

[edit] External links

  1. ^ What's a good way to check for close enough floating-point equality