From: "Norbert Grün" <gnor-spam@x-mail.net>
Subject: Are integer operations really integral?
Date: Mon, 09 Jan 2006 20:57:37 +0100 [thread overview]
Message-ID: <1136836657.43c2c0311e572@www.x-mail.net> (raw)
Dear Madam or Sir!
I recently used Emacs 20.7 for WinNT to check the date of the initial
issue
of our longtime weekly pulp Sci-Fi novel Perry Rhodan
(www.Perry-Rhodan.net).
I fired up the calendar, positioned to 2006-01-06 for volume 2316 and
said
C-u 2316 C-p
to go back this many weeks.
I landed on 1961-08-18 whereas the mag part told of 1961-09-08 which is
three weeks later.
I sent already a mail to the publishers whether they had issued two
volumes
a week for a couple of times when changing publishing day which had
happened a few times in the past.
The error is 0.13% which may or may not pile up in floating point
calculations when iterated that many times.
But a C-u <num> <command> repetition is integral in its very nature
and the
ELISP engine should be much happier with integers for decrementing the
loop
over the <command> than fiddling with floats and doubles.
ALGOL60 allowed REALs as loop and ARRAY indices, PASCAL stopped this
abuse.
C(++) may allow it, but it is highly disrecommended because a loop
termination condition testing for equality against an integral value
like
zero is almost guaranteed to fail resulting in an endless loop. Also
testing for inequality will result in haphazard one-off errors hard to
debug. Also integers should be large enough to avoid a rollover as I
realised once on a VAX.
So please check whether your integer arithmetic is not secretly
converted
to float in a dark corner of your code albeit this should be ironed out
long ago regarding the major version (20.7).
Kind Regards
Norbert Grün (gnor-spam@x-mail.net)
--
Stop wasting everybody else's ressources!
------------------------------------------------------------------------------------
Free X-Mail.net, Voice Calls (VoIP) and Messages, Messenger, http://www.x-mail.net
SnoopBlocker Anonymous SSL Secure Web Surfing, http://www.snoopblocker.com
Search Teradex Web Site Directory http://www.teradex.com
reply other threads:[~2006-01-09 19:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1136836657.43c2c0311e572@www.x-mail.net \
--to=gnor-spam@x-mail.net \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).