unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: goncholden <goncholden@protonmail.com>
Cc: help-gnu-emacs@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: version> and version>=
Date: Wed, 02 Feb 2022 15:23:36 +0100	[thread overview]
Message-ID: <877dad2vgm.fsf@gnu.org> (raw)
In-Reply-To: <FX9Yq2WHVzOBG4hojIcAvh8vHdFO7CdBPrpUauPIwyREZJkUCQ0XF2KqWvEQ9Wb2IA309PiO2tCZFYLfwmTYklOeJBZZunkNtau4vc7fplM=@protonmail.com>

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	other threads:[~2022-02-02 14:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 18:01 version> and version>= goncholden
2022-02-01 23:20 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-02  3:47 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-02-02 10:21   ` goncholden
2022-02-02 13:38     ` Tassilo Horn
2022-02-02 13:48       ` goncholden
2022-02-02 13:52         ` Tassilo Horn
2022-02-02 14:14           ` goncholden
2022-02-02 14:23             ` Tassilo Horn [this message]
2022-02-02 14:15         ` Tassilo Horn
2022-02-02 14:27           ` goncholden
2022-02-02 14:30             ` Tassilo Horn
2022-02-02 14:51         ` Eli Zaretskii
2022-02-02 15:00     ` Yuri Khan
2022-02-02 15:07       ` goncholden
  -- strict thread matches above, loose matches on Subject: below --
2022-02-01 14:50 goncholden via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dad2vgm.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=goncholden@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).