Semantic Version Comparator
Compare two semantic versions exactly per semver.org precedence: numeric major.minor.patch, prerelease identifier rules, and build metadata ignored.
Description
Compare two semantic versions exactly per semver.org precedence: numeric major.minor.patch, prerelease identifier rules, and build metadata ignored.
Semantic Version Comparator: Compare two semantic versions exactly per semver.org precedence: numeric major.minor.patch, prerelease identifier rules, and build metadata ignored.
When to use Semantic Version Comparator
Use this semantic-version operation to compare or test versions that follow the SemVer major.minor.patch grammar and its prerelease precedence rules.
- Version A
- First version, e.g. 1.2.3 or 2.0.0-rc.1+build.5.
- Version B
- Second version to compare against.
How Semantic Version Comparator works
Compare two semantic versions exactly per semver.org precedence: numeric major.minor.patch, prerelease identifier rules, and build metadata ignored. The tool evaluates the supplied inputs together and returns the named outputs below; it does not infer omitted operating conditions or change the units shown.1
- Comparison
- -1 if A < B, 0 if equal precedence, 1 if A > B.
Limitations and assumptions
- Semantic Versioning describes version syntax and declared compatibility intent; it does not prove that releases are compatible. Ecosystems may use different range grammars, leading zeros, build metadata, prerelease inclusion rules, or non-SemVer versions.
- Use finite inputs in the displayed units and preserve more precision than the final presentation requires. Independently verify safety-critical, financial, compliance, or production decisions.
Alternative or Complementary approaches
Use the package ecosystem's own resolver before changing a lockfile, and confirm compatibility with tests and release notes. Keep version comparison separate from lexical string ordering.
References
-
Software versioning — Wikipedia contributors
Similar or alternative tools
- Semantic Version Range Checker
Check a semantic version against a whitespace-joined AND set of comparators (=, <, <=, >, >= plus caret ^ and tilde ~ shorthands with npm-style bump rules); build metadata is ignored.
- Daily Growth Coefficient
Compare cube-root body-weight growth per day; weight units must remain grams for comparison across batches.
- Specific Growth Rate
Calculate log-based specific growth rate between two positive fish weights, in percent per day.