[GH-ISSUE #348] Rule 2 appears to forbid zero as a version number component #1988

Closed
opened 2026-04-20 09:50:54 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ediosyncratic on GitHub (Jan 5, 2017).
Original GitHub issue: https://github.com/semver/semver/issues/348

Rule 2: A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes.

The number 0 has a leading zero, but you do allow it in 0.1.0 and 1.0.0, etc.
I guess what you mean by "leading" in this case isn't just "it's the first digit" but also "it's redundant".
It may be simplest to say that X, Y and Z are natural numbers in canonical decimal form; the canonical form omits leading zeros save for 0 itself.
Alternatively, specify "counting number" to mean a sequence of decimal digits in which no zero is before another digit unless it is after another digit; then say that X, Y and Z are counting numbers.

Originally created by @ediosyncratic on GitHub (Jan 5, 2017). Original GitHub issue: https://github.com/semver/semver/issues/348 Rule 2: A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers, and MUST NOT contain leading zeroes. The number 0 has a leading zero, but you do allow it in 0.1.0 and 1.0.0, etc. I guess what you mean by "leading" in this case isn't just "it's the first digit" but also "it's redundant". It may be simplest to say that X, Y and Z are natural numbers in canonical decimal form; the canonical form omits leading zeros save for 0 itself. Alternatively, specify "counting number" to mean a sequence of decimal digits in which no zero is before another digit unless it is after another digit; then say that X, Y and Z are counting numbers.
Author
Owner

@krzysiekpiasecki commented on GitHub (Jan 5, 2017):

A leading zero is any 0 digit that comes before the first nonzero digit in a number string in positional notation.[1]

https://en.wikipedia.org/wiki/Leading_zero

<!-- gh-comment-id:270710355 --> @krzysiekpiasecki commented on GitHub (Jan 5, 2017): > A leading zero is any 0 digit that comes before the first nonzero digit in a number string in positional notation.[1] https://en.wikipedia.org/wiki/Leading_zero
Author
Owner

@ediosyncratic commented on GitHub (Jan 5, 2017):

I'm convinced :-)

<!-- gh-comment-id:270732849 --> @ediosyncratic commented on GitHub (Jan 5, 2017): I'm convinced :-)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#1988