Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: ding@gnus.org
Subject: Re: Gnus/5.1299999999999999
Date: Tue, 23 Jul 2013 14:22:50 +0900	[thread overview]
Message-ID: <b4mhafl4zpx.fsf@jpl.org> (raw)
In-Reply-To: <m37gytnvkq.fsf@stories.gnus.org>

cf. http://thread.gmane.org/gmane.emacs.gnus.general/81516

Lars Magne Ingebrigtsen wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>> No difference is in Gnus v5.13 nor Emacs 23.3.  Only XEmacs is
>> sane.  What I can observe in Emacs's *scratch* buffer are:
>>
>> 5.13
>>  => 5.1299999999999999

> Well, that's probably as "correct" as 5.13.  Representing floating point
> numbers is tricky.

Yes, that's correct, as for "Gnus v5.13".  However, as for "Ma Gnus",
it is 5.1299999999999999 on Cygwin no matter what the version number
is:

(gnus-continuum-version "Ma Gnus v0.1")
 => 5.1299999999999999
(gnus-continuum-version "Ma Gnus v0.99")
 => 5.1299999999999999

So, it not only makes the User-Agent header ugly, but also disables
`gnus-update-format-specifications' from comparing the newsrc file
versions.

> Could `gnus-extended-version' be fixed somehow?  By using, for instance,
> %10.8f instead of %s, and then trimming back trailing zeroes?

Unfortunately, no.
Because the value is broken by `gnus-continuum-version' before
it is passed to `gnus-extended-version'.  How it breaks it is as
follows:

(defun gnus-continuum-version (&optional version)
  "Return VERSION as a floating point number."
[...]
;; Where `alpha' is "Ma", `minor' is 8, and `least' is 0.
  (string-to-number
   (format "%s00%02d%02d"
           (+ 5 (* 0.02
                   (abs
                    (- (mm-char-int (aref (downcase alpha) 0)) ;; 109
                       (mm-char-int ?t) ;; 116
                       )                ;; -7
                    )                   ;; 7
                   )                    ;; 0.14000000000000001
              -0.01)                    ;; 5.1299999999999999
           minor least)                 ;; "5.1299999999999999000800"
   )                                    ;; 5.1299999999999999

Now I've committed a new idea.  The main point of this change is
to make it do the main calculations in integers.  This will work
on any platform, from "(ding) Gnus" through "A* Gnus".

(gnus-continuum-version "Ma Gnus v0.8")
 => 5.1300080000000001
(gnus-continuum-version "Gnus v5.13")
 => 5.1299999999999999
(gnus-continuum-version "A* Gnus v0.1")
 => 5.3700010000000002

(gnus-extended-version)
 => "Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (cygwin)"
(let ((gnus-version "Gnus v5.13"))
  (gnus-extended-version))
 => "Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (cygwin)"
(let ((gnus-version "A* Gnus v0.1"))
  (gnus-extended-version))
 => "Gnus/5.370001 (A* Gnus v0.1) Emacs/24.3.50 (cygwin)"



  reply	other threads:[~2013-07-23  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05  8:59 Gnus/5.1299999999999999 Katsumi Yamaoka
2012-03-10  0:33 ` Gnus/5.1299999999999999 Lars Magne Ingebrigtsen
2013-07-23  5:22   ` Katsumi Yamaoka [this message]
2013-07-23  6:09     ` Gnus/5.1299999999999999 Katsumi Yamaoka

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

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

  git send-email \
    --in-reply-to=b4mhafl4zpx.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.org \
    /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 NNTP newsgroup(s).