Re: dpkg doing wrong math (0.09 = 0.9) ?- [was: dak now supports ~ in version numbers]
On Fri, Aug 11, 2006 at 10:42:53AM +1000, Matthew Palmer wrote:
> On Thu, Aug 10, 2006 at 07:47:36PM -0400, Roberto C. Sanchez wrote:
>> On Fri, Aug 11, 2006 at 01:29:40AM +0200, Adeodato Simó wrote:
>>> * Michael Biebl [Fri, 11 Aug 2006 01:12:59 +0200]:
>>>> that "dpkg --compare-versions '0.09' '=' '0.9'" yields true, which I
>>>> think is rather odd,
>>> 0.09 = 0.9 means:
>>> 0 == 0
>>> . == .
>>> 09 == 9
>>> Which is pretty standard math. ;-)
>> Except that the final comparison ignores that the number was to the
>> right of the decimal, making the zero significant. I think you
>> will be hard pressed to find a mathematician who supports dropping
>> significant zeros for no good reason.
> I'd imagine you'd be hard pressed to find a mathematician who knows
> what to do with a number that reads 0.0.9, either.
Well, I have found one. Myself. You just have to interpret the part
after the second point as the integer part of an infinitesimal:
Let ε be an infinitesimal, that is a strictly positive number
(that is ε > 0) smaller than any strictly positive real number
(that is ∀ n ∈ ℕ, n>0 implies ε < 1/n ).
Then the version number x.y.z is interpreted as:
x.y + z * ε
(And a.b.c.d is interpreted as a.b + c.d * ε)
Before anyone asks, yes I can go on for as many dots as you want. I
just introduce a η that is strictly positive, yet strictly smaller
than any ε/n for n ∈ ℕ, and I have up to five dots (six
components). There are probably several ways to construct suitable ε
and η and beyond, but presenting one of them is off-topic; I can
present at least one of them to interested persons (Conway surreal
numbers). Actually, in the Conway surreal numbers formalism, ε² would
be a suitable η, but one can do better (a η that is smaller than any
power of ε, yet strictly positive).
One can also take the problem the other way round and use very big
numbers instead of very small ones (for example the א hierarchy); the
order is much less natural then, though.