Is there some metric for computing similarity between two numbers which takes values in the interval $[0, 1]$?

I want something like:
$sim(1,1) = 1$
$sim(1,2) = 0.5$
$sim(50,47) = 0.78$
$sim(100,99) = 0.99$

If two numbers are small, then similarity is sensitive. But, if two numbers are big, then similarity is less sensitive.

Is there some metric like that?

  • $\begingroup$ Have you tried dividing the small number by the large one? It seems to do exactly what you're asking for in three of your four examples. $\endgroup$ – Arthur Oct 15 '15 at 12:18
  • $\begingroup$ you are right. I use "min(num1,num2) / max(num1, num2)" and it have the property that i want. thanks. $\endgroup$ – jin-seo.lee Oct 19 '15 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.