# How to rate the similarity of aspect ratio of rectangles

Given two rectangles, and a maximum difference score, tell me whether the aspect ratio of these rectangles are considered similar or not?

For example a $$2\times4$$ rectangle [ratio $$0.5$$] and a $$2\times3$$ [ratio $$0.66$$] are considered similar, meaning that the difference of $$0.16$$ is still considered similar.

Also a $$4\times2$$ rectangle [ratio $$2$$] and a $$3\times2$$ rectangle [ratio $$1.5$$] are both considered similar and the difference is $$0.5$$ which is much larger than $$0.16$$ and yet is considered similar.

Another example of a $$3\times2.9$$ rectangle and a $$2.8\times3.1$$ rectangle are also considered similar.

How can one give one formula for calculating such a thing?

Further clarification

Let us represent a completely identical ratio with a score of $$0$$, meaning that there is no change between them

Let's represent a completely different ratio with a score of $$1$$

Let's say that the largest rectangle can be up to $$1000$$ width or up to $$1000$$ height

Example of the same ratio: $$2\times3$$ rectangle and $$4\times6$$ rectangle and the like

An example of a completely different ratio: a $$1\times1000$$ rectangle and a $$1000\times1$$ rectangle

There is no mathematical definition for the similarity of aspect ratios. You might consider the ratio of the aspect ratios as a measure of aspect ratio similarity. The closer to $$1$$ the more similar.