Re: 0.01-6 > 0.1-3 ?????
On Tue, Apr 23, 2002 at 12:35:32PM +1000, Firewall wrote:
> On Mon, 22 Apr 2002 07:01:34 -0700
> "Randolph Chung" <email@example.com> wrote:
> > > What exactly do you mean by numerically? Is 0.00001 == 0.01 == 0.1 ==
> > > 1.0 == 10 == 100000? What should be watched out for?
> > From the debian policy manual (section 4):
> > "The strings are compared from left to right.
> > First the initial part of each string consisting entirely of non-digit
> > characters is determined. These two parts (one of which may be empty)
> > are compared lexically. If a difference is found it is returned. The
> > lexical comparison is a comparison of ASCII values modified so that all
> > the letters sort earlier than all the non-letters.
> > Then the initial part of the remainder of each string which consists
> > entirely of digit characters is determined. The numerical values of
> > these two parts are compared, and any difference found is returned as
> > the result of the comparison. For these purposes an empty string (which
> > can only occur at the end of one or both version strings being compared)
> > counts as zero.
> > These two steps (comparing and removing initial non-digit strings and
> > initial digit strings) are repeated until a difference is found or both
> > strings are exhausted."
> > randolph
> Ive read that a few times and still dont think i undersstand it properly,
> can someone rephrase it in laymans terms ?
> I cant see any way of interpreting the policy in which 0.1 == 0.01, 0 is a
> digit which still has to be compared, it looks to me like it has to be a
> bug in dpkg.
> "The numerical values of these two parts are compared, and any difference
> found is returned as the result of the comparison", so if we compare two
> version, 0.01 and 0.1 then the (numerical) difference is +/- 0.09 not 0.
Let's see if I can clear this all up in a single post (and I hope I'm
not confused myself ;) ).
The dot ('.') is treated as major/minor version number, not a decimal
point. So for 0.01 and 0.1 we have this:
major: 0 0
minor: 1 01
1 == 01, so they're the same. And again, for 0.9 and 0.89:
major: 0 0
minor: 9 89
89 is higher than 9, so it's a higher version number. Now, if you
wanted them to work as decimal numbers you need to append a 0:
major: 0 0
minor: 90 89
90 is higher than 89, so it works as you intended it.
And finally, this is not a bug, it's a feature. In debian, they are
treated as major/minor version numbers, NOT decimal numbers, and
because of this you can keep going past 99 (0.100 > 0.99).
Did I miss anything?
Adam Olsen, aka Rhamphoryncus
To UNSUBSCRIBE, email to firstname.lastname@example.org
with a subject of "unsubscribe". Trouble? Contact email@example.com