Difference distance

Definition
Given a numeric set $$\textstyle \mathcal{N}$$, the diference distance is a distance function $$\textstyle DiffDis: \mathcal{N}\times \mathcal{N}\longrightarrow \mathbb{R}^+$$ such that $$\textstyle \forall x,y\in \mathcal{N}$$


 * $$ DiffDis(x,y)=|x-y|. $$

Examples

 * $$DiffDis(-2,4) = 6$$
 * $$DiffDis(2.5, -1.2) = 3.7$$

Normalization
It is not possible when the range of $$\textstyle \mathcal{N}$$ is not bounded, otherwise


 * $$ DiffSim(x,y)=1-\frac{|x-y|}{\max(\mathcal{N})-\min(\mathcal{N})}. $$

Examples

 * If $$\textstyle \mathcal{N}=\{0,1,2,\ldots,100\} \quad DiffSim(4,14) = 1-\frac{|4-14|}{100-0} = 0.9$$
 * If $$\textstyle \mathcal{N}=[-10,10] \quad DiffSim(2.5,-1.2) = \frac{|-1.2-2.5|}{10-(-10)} = 0.815$$