Comparing Versions

Numeric version comparisons can be tricky, because they are not numbers in the traditional sense. Version numbers typically have multiple segments separated by periods, such as "6.01.2.3". A common (but not universal) structure numbers the releases like this:

major.minor[.revision[.build]]

So, when you compare versions, you need to specify all the relevant segments to get a proper comparison. If you compare them as if they were integers or floating point numbers, you may get the wrong answer. Consider these examples:

Q: "6" as version < "6.44" as version
A: False
Q: "6.0" as version < "6.44" as version
A: True

The second relevance expression works, because it has the same number of version segments, so it compares properly.

Q: "5" as version = "5.50" as version
A: True
Q: "5.00" as version = "5.50" as version
A: False

The second expression fails properly, because it compares a two-segment version to another two-segment version.

Don’t assume the version segments are two-digits:

Q: "5.100" as version > "5.99" as version
A: True
Q: "5.10" as version > "5.99" as version
A: False

The Relevance language compares the numeric values of the version segments (separated by periods), regardless of the number of digits in the segment. To be safe, always specify complete version numbers.