From: Jean Louis <bugs@gnu.support>
To: Arthur Miller <arthur.miller@live.com>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>,
Stefan Monnier <monnier@iro.umontreal.ca>,
John Yates <john@yates-sheets.org>
Subject: Re: What is 0.01 here not 0.01 here 0.009999999999999?
Date: Sat, 3 Apr 2021 08:36:10 +0300 [thread overview]
Message-ID: <YGf+ysqlFBgF/k6m@protected.localdomain> (raw)
In-Reply-To: <AM9PR09MB4977EF295A03ECF6DFDE8AC796799@AM9PR09MB4977.eurprd09.prod.outlook.com>
* Arthur Miller <arthur.miller@live.com> [2021-04-03 07:41]:
> > Because it is database backed, minimum interaction with the
> > system is possible. In general, registered files are recorded in
> > the database on each kill or save of the buffer, or by single
> > key. I find it handy without any interactions.
>
> Two different ways, each part on it's own, or as one macro. Much simpler
> than your decimal handling. I suggest to change your database scheme and
> store those as integers there too so you don't need to convert back and
> forth. Even better, skip the database and keep version number directly
> in your paper which you hopefully write in an org file ;-).
You know how version numbers may contain letters? That is why it is
string. Those which do appear as `numeric' type, I can easily "cast":
SELECT DISTINCT vc_revision::numeric FROM vc;
vc_revision
-------------
1.23
1
1.19
0.02
Then I could also use PostgreSQL mathematics to increase the `numeric'
cast:
SELECT DISTINCT trunc(vc_revision::numeric, 2) FROM vc WHERE vc_id = 6826;
trunc
-------
0.50
(1 row)
rcdbusiness=# SELECT DISTINCT trunc(vc_revision::numeric + 0.01, 2) FROM vc WHERE vc_id = 6826;
trunc
-------
0.51
Thus I could replace the function which I made in Emacs Lisp with
PostgreSQL combination.
These functions are insightful. I have to keep it a a note for
later. As they need to be decided by author. Maybe some intelligence
can be increased for computer to ask for a revision to be increased,
depending on the quantity of text changed.
> (defun rcd-vc-increase-major-number (version)
> (aset version 0 (1+ (aref version 0))))
>
> (defun rcd-vc-increase-minor-number (version)
> (aset version 1 (1+ (aref version 1))))
>
> (defun rcd-vc-increase-revision-number (version)
> (aset version 2 (1+ (aref version 2))))
>
> (defmacro incr-version (version-part version)
> `(cond ((equal ,version-part 'major)
> (aset ,version 0 (1+ (aref ,version 0))))
> ((equal ,version-part 'minor)
> (aset ,version 1 (1+ (aref ,version 1))))
> ((equal ,version-part 'revision)
> (aset ,version 2 (1+ (aref ,version 2))))))
>
> (defun version-string (version)
> (format "%s.%s.%s" (aref version 0) (aref version 1) (aref version 2)))
>
> Eaxmple of usage:
>
> (defvar my-version [0 0 0])
>
> (rcd-vc-increase-revision-number my-version)
> (version-string my-version)
>
> (incr-version 'major my-version)
> (incr-version 'minor my-version)
> (incr-version 'revision my-version)
> (version-string my-version)
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://rms-support-letter.github.io/
next prev parent reply other threads:[~2021-04-03 5:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 13:42 What is 0.01 here not 0.01 here 0.009999999999999? Jean Louis
2021-04-02 13:56 ` Stefan Monnier
2021-04-02 17:03 ` Jean Louis
2021-04-02 17:41 ` Teemu Likonen
2021-04-02 18:44 ` Jean Louis
2021-04-02 20:46 ` John Yates
2021-04-02 21:19 ` Jean Louis
2021-04-02 22:04 ` John Yates
2021-04-02 23:29 ` Jean Louis
2021-04-03 4:39 ` Arthur Miller
2021-04-03 5:36 ` Jean Louis [this message]
2021-04-03 3:56 ` Arthur Miller
2021-04-03 5:19 ` Jean Louis
2021-04-03 13:54 ` Stefan Monnier
2021-04-02 14:02 ` Eli Zaretskii
2021-04-02 17:07 ` Jean Louis
2021-04-03 4:49 ` Arthur Miller
2021-04-16 20:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-17 10:53 ` Jean Louis
2021-04-19 10:51 ` Eric S Fraga
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=YGf+ysqlFBgF/k6m@protected.localdomain \
--to=bugs@gnu.support \
--cc=arthur.miller@live.com \
--cc=help-gnu-emacs@gnu.org \
--cc=john@yates-sheets.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).