help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: version> and version>=


From: Tassilo Horn
Subject: Re: version> and version>=
Date: Wed, 02 Feb 2022 15:23:36 +0100
User-agent: mu4e 1.7.6; emacs 29.0.50

goncholden <goncholden@protonmail.com> writes:

> Although there is nothing wrong about floats because version numbers
> can easily be sorted numerically.

No, they cannot.

ELISP> (sort '(1.2 1.12) #'<)
(1.12 1.2)

ELISP> (sort '("1.2" "1.12") #'version<)
("1.2" "1.12")

Also, the common version 0.1 (and many other fractions) cannot be
represented as a float.  0.1 is not really 0.1 which you only see if you
print enough digits:

*** Eval error ***  Format string ends in middle of format specifier
ELISP> (format "%.20f" 0.1)
"0.10000000000000000555"

Aside from that, versions tend to have the form major.minor.micro with
optionally even stuff like -<alpha|beta|rc><number> appended.  Hard to
encode into a float.

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]